I would like to adjust the coupon so that it may only be used once per user. Currently a coupn code can be repeatedly used by one user on as many transactions as they wish. Generally when you recieve a coupon (in the real world) you may only use it once. I would like to offer promotional discounts to my customers but this factor is holding me back. Is there a way with the existing nopCommerce (any version) of acheiving this? If not is there a tweak/hack to reslove this issue? Thanks CAWPublishing.co.uk/
Next release will be published in March. Currently, I cannot disclosure too much, but briefly, it'll include almost everything that general ecommerce site should have
If you are using 1.40 and cannot wait for the next release, you can put this piece of code in CustomerManager.cs > ResetCheckoutData (after line 461 - if (ClearCouponCode) - and before the line customer = ApplyCouponCode(customer.CustomerID, string.Empty);)
This will make sure that coupon codes that start with 1- are deleted once they are used the first time. You can offcourse change the string that the coupon should start with by changing the value in the code below.
//Added feb 2010 - make single use coupons possible
if (customer.LastAppliedCouponCode.StartsWith("1-")) { Promo.Discounts.Discount currentdiscount = null; foreach (Promo.Discounts.Discount discount in Promo.Discounts.DiscountManager.GetAllDiscounts(Promo.Discounts.DiscountTypeEnum.AssignedToSKUs)) { if (customer.LastAppliedCouponCode == discount.CouponCode) { currentdiscount = discount; break; } }
if (currentdiscount == null) { foreach (Promo.Discounts.Discount discount in Promo.Discounts.DiscountManager.GetAllDiscounts(Promo.Discounts.DiscountTypeEnum.AssignedToWholeOrder)) { if (customer.LastAppliedCouponCode == discount.CouponCode) { currentdiscount = discount; break; } } }
if (currentdiscount == null) { Promo.Discounts.DiscountManager.MarkDiscountAsDeleted(currentdiscount.DiscountID); } }
I'm using nopcommerce 3.8 and have an issue with discounts. I created a discount with the limitation of N time per costumer= 1 but if my customer checkout as gest he can use the coupon code as much as he wants. How can I fix it?
RE: "checkout as guest he can use the coupon code as much as he wants"
I think preventing that will require customization. You would need some criteria to match the guest's order with something from another order - e.g. billing or shipping address.