I created a custom module for applying custom coupon code programmatically in magento 2.
For shopping cart rule.
I have only coupon code with block and model collection check below image.
How can do it ? Any suggestion for that ?
coupon-codesmagento-2.1magento2shopping-cart-price-rules
Best Answer
First you need to inject a few classes in your constructor:
Then in your code you can do: Data.php in helper
Here use own create function replace
$cartQuote->getCouponCode();
to$cartQuote->getOwnFuction();
And put code ingetOwnFuction()
forapply custom couponCode
And then i put in my function: Vendor\Shipping\Model\Quote\Address\Rate.php