- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2017
12:46 PM
10-17-2017
12:46 PM
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
6x certified Magento Specialist.
Nigel Boulton, Magento Solution Specialist
Nigel Boulton, Magento Solution Specialist
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017
12:42 PM
10-19-2017
12:42 PM
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.
6x certified Magento Specialist.
Nigel Boulton, Magento Solution Specialist
Nigel Boulton, Magento Solution Specialist
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2017
12:42 PM
10-19-2017
12:42 PM
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.
6x certified Magento Specialist.
Nigel Boulton, Magento Solution Specialist
Nigel Boulton, Magento Solution Specialist