cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic shopping cart price rule does not apply if coupon code is applied

SOLVED

Automatic shopping cart price rule does not apply if coupon code is applied

I am trying to set an automatically generated coupon code to a Magento 2 quote.
I am using is:

        $this->_checkoutSession->getQuote()->setCouponCode($post['coupon_code'])->setTotalsCollectedFlag(false)->collectTotals()->save();

The coupon code is being set in the quote but it is not updating when redirected by to the Magento cart page

Triple Certified Magento Specialist.
Magento Solution Specialists
1 REPLY

Re: Automatic shopping cart price rule does not apply if coupon code is applied

My original code worked with a single coupon code but not with multiple generated codes. I have resolved this by copying the couponPost controller from Magento_Checkout into my module and make the necessary changes. 

Triple Certified Magento Specialist.
Magento Solution Specialists