Skip to content
Snippets Groups Projects

Issue #3414323: Added the checkbox for allow_multiple_coupons field and added...

Merged Issue #3414323: Added the checkbox for allow_multiple_coupons field and added...

Files

@@ -226,6 +226,18 @@ class Coupon extends CommerceContentEntityBase implements CouponInterface {
return FALSE;
}
$promotion = $this->getPromotion();
$coupons = $order->get('coupons')->referencedEntities();
foreach ($coupons as $coupon) {
if (
$this->id() !== $coupon->id() &&
$promotion->id() === $coupon->getPromotionId() &&
!$promotion->isMultipleCouponsAllowed()
) {
return FALSE;
}
}
$usage_limit = $this->getUsageLimit();
$usage_limit_customer = $this->getCustomerUsageLimit();
// If there are no usage limits, the coupon is available.
Loading