Whenever customers can shop anonymously and enter coupon codes before logging in or entering an email address at checkout, we have an issue related to whether the coupon should be applied. Specifically, if a coupon/promotion has a condition that relates to the email address (such as usage limits) or customer information, applying the coupon before the customer/email is known could result in revoking the coupon once the customer/email is known.
The most straightforward approach is to just always require an email address before applying any coupon that has those types of conditions. The problem with this approach in practice is that customers shopping anonymously will get "invalid coupon code" messages for coupons that are actually valid for them.
Once Issue #2872455: Allow coupons to be redeemed on the cart page → lands, this becomes a problem. Also, this issue is currently blocking progress on Issue #2902495: Allow promotion usage to be limited per-customer → .
1. Add a setting to coupons:
Require email address for customer usage.
When enabled, the coupon will not be available until the order has an associated email address.
2. Create a CouponIneligibleEvent
to be fired whenever a coupon is removed from an order in PromotionOrderProcessor
.
When the required-email-address setting is not set, coupons may be removed when an email address is entered. This event lets developers handle responses in the context of specific promotion conditions.
For Issue #2902495: Allow promotion usage to be limited per-customer → , we can create a basic event subscriber related to revoking coupons based on usage.
Active
3.0
Promotions
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.