2

In my module I have condition like cart price rule. How to check item in cart satisfy condition or not.

1
  • Hi. Did you find some solution?
    – spiilmusic
    Commented Feb 22, 2018 at 9:46

1 Answer 1

-1

Create a coupon code with the condition you have with 0% discount just to test the condition satisfying or not. Then you can apply that coupon code to your cart.

$quote = $this->cart->getQuote();
$quote->setCouponCode($couponcode)->collectTotals()->save();
$quoteCouponCode = $quote->getCouponCode();
if ($quoteCouponCode) {
   //condition is satisfied
   /*
    * your logic
    */    
}
$quote->setCouponCode('')->collectTotals()->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.