Magento Forum

   
How do I limit the uses per customer for not logged in customers on shopping cart rules? 
 
BVBAccelerate
Member
 
Avatar
Total Posts:  72
Joined:  2009-05-19
Rochester, NY
 

We have a price rule with a coupon code and their uses per customer is set to 1.

A customer who is not logged in and has been able to use the same coupon code more than once. How does Magento make sure that not logged in customers aren’t able to use the coupon code more than once? I figured an IP address or email or something, but from what I’m seeing it just doesn’t work.

Is this a bug?

Please let me know how to do this or if it is not possible.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3756
Joined:  2009-11-10
 

Set “Uses per coupon” to “1” ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
BVBAccelerate
Member
 
Avatar
Total Posts:  72
Joined:  2009-05-19
Rochester, NY
 

Wouldn’t that make it so that the coupon could only be used once? We want the coupon to be able to be used more than once, but we don’t want a customer to be able to use it more than once.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3756
Joined:  2009-11-10
 

Can you check?  It may depend on the magento version (I’m not sure however)

 
Magento Community Magento Community
Magento Community
Magento Community
 
BVBAccelerate
Member
 
Avatar
Total Posts:  72
Joined:  2009-05-19
Rochester, NY
 

I checked, and when I put uses per coupon to 1 I was unable to use it. Some people have already used that coupon code, and I applied it from an different IP address before any of my information was inserted for checkout too. So, I feel safe assuming that the 1 uses per coupon is applied to the total amount of times the coupon can be used regardless of who is using it.

I’m using Magento 1.4.0.1. Not sure if this is a known bug for this version of Magento, or if I’m just not understanding the way it’s processed. Does anyone know where the code is for this so I can check how it is being processed?

This could be a serious problem for a client if people can just continually place new orders and receiving the discount from the code every time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BVBAccelerate
Member
 
Avatar
Total Posts:  72
Joined:  2009-05-19
Rochester, NY
 

Looking into the database I’m seeing that the coupon code is being included on the order in the sales_order table. However, I am not seeing any entry in the salesrule_customer table, presumably because customer_id is a field and they are not assigning an ID to not logged in customers from what it looks like in the sales_order table.

Does this mean that you can not limit the users per customer on people who aren’t logged in?

In /app/code/core/Mage/SalesRule/Model/Validator.php on line 138:

if ($ruleId && $rule->getUsesPerCustomer()) {
                $customerId     
$address->getQuote()->getCustomerId();
                
$ruleCustomer   Mage::getModel('salesrule/rule_customer');
                
$ruleCustomer->loadByCustomerRule($customerId$ruleId);
                if (
$ruleCustomer->getId()) {
                    
if ($ruleCustomer->getTimesUsed() >= $rule->getUsesPerCustomer()) {
                        $rule
->setIsValid(false);
                        return 
false;
                    
}
                }
            }

It looks here like if there is no customer ID they aren’t even checking to see if they can validate the number of uses per customer. Am I understanding this correctly?

Even if this isn’t a ‘bug’ per se it’s a very important aspect of Sales Rules that isn’t explained at all in any of the tutorials or documentation that I have read. I’d really like some sort of clarification on this.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
g0rdian
Member
 
Total Posts:  65
Joined:  2011-12-04
 

Did you ever solve this issue?

I would think there would be a way to check coupon use based on IP, email, or even last 4 digits of the card used!

Thanks for any follow-up!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3756
Joined:  2009-11-10
 
g0rdian - 12 December 2012 03:03 PM

I would think there would be a way to check coupon use based on IP, email, or even last 4 digits of the card used!

You can use any customer attributes in coupon conditions, such as email, date of birth, ID, etc with Special Promotions Pro extension.

 
Magento Community Magento Community
Magento Community
Magento Community
 
antarcool98
Jr. Member
 
Total Posts:  5
Joined:  2012-01-10
 

I have an issue with the coupon code in magento 1.6.After applying coupon code when we click on continue shopping and then add another product the discount price gets deducted twice.Any help to restrict the apply of coupon code once.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top