/** * Check if cart meets basic requirements for a coupon * * @param CartCouponOnCheckEvent $event * * @throws AbstractCouponException */ public function checkCoupon(CartCouponOnCheckEvent $event) { if ($event->getCart()->getTotalItemNumber() === 0) { throw new CouponIncompatibleException(); } $coupon = $event->getCoupon(); $this->couponManager->checkCoupon($coupon); }
/** * Check if cart meets basic requirements for a coupon * * @param CartInterface $cart Cart * @param CouponInterface $coupon Coupon * * @throws CouponIncompatibleException Coupon incompatible */ public function validateCoupon(CartInterface $cart, CouponInterface $coupon) { if ($cart->getTotalItemNumber() === 0) { throw new CouponIncompatibleException(); } $this->couponManager->checkCoupon($coupon); }