1

How can i apply coupon code programatically in magento 2 using cartid.

0

I believe checkout session can be used instead cartId use below code:

Two steps:

1 => Define \Magento\Checkout\Model\Session in your constructor

2 =>

$this->checkoutSession->getQuote()->setCouponCode($couponCode)->collectTotals()->save();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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