Try our conversational search powered by Generative AI!

Max Redemptions Per Customer promo commerce field question

Vote:
 

Hi there,

I spent some time looking into an issue in EPi 7.5, where certain promotions, with promo codes, seemed to not be available or redeemable by anonymous users. I tracked the issue down to the Max. Redemptions Per Customer field in Commerce. If it has a value that's not 0, it triggers Commerce code that disallows that promotion for anonymous users. Setting that field to 0 will "fix" (aka work around) this issue at this time. But obviously, if we ever want to create a promotion that is only available for redemption once per customer, this limitation will disallow that.

For a more technical note, I looked inside the EvaluatePromotions call, inside the CalculateDiscountsActivity.cs file. Looking at the decompiled Commerce file MarketingContext.cs, line #221, there is the following check:

if (promotionItem.DataRow.CustomerLimit > 0 && (SecurityContext.Current.LoggedInUser == null || customerId == Guid.Empty || promotionItem.DataRow.CustomerLimit > 0 && promotionItem.GetCustomerUsageCount(customerId) - context.ReservedCount + count >= promotionItem.DataRow.CustomerLimit))

That check will be true for anonymous users (and will result in prematurely skipping the current promo evaluation logic), and false for logged-in users (due to the SecurityContext.Current.LoggedInUser == null being false), which will allow the current promo evaluation to continue and be properly applied.

My question actually is -- is this a bug, or intended functionality in Commerce 7.5? A colleague of mine suggested this may be intended, since there isn't a foolproof way to guard against anonymous users claiming multiple promotions, intended to be available only once per customer. At the same time, I don't see why this wouldn't at the very least enforce the Max. Redemptions Per Customer field value for anonymous users' temporary customer ID's that Epi creates. They could still definitely bypass this via anonymous browser sessions or using other devices, sure, but disallowing the promo to all anonymous users based on a value existing in that field seems a bit extreme. So I thought I'd check :)

Thanks for any input!

#142316
Dec 08, 2015 21:28
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.