2

I have a price rule attached to the flat rate shipping method as an option, and I want to intercept when the coupon is added, so that I can hide this flat rate method unless the coupon code matches the code value in the option. I have a model setup for retrieving the coupon code that is attached to the shipping method, but I don't know how to hide, show and auto select a shipping method once I compare the coupon codes.

For example, I am not sure if it is possible to do what I want when I override \Magento\Checkout\Controller\Cart\CouponPost.

enter image description here

5
  • As I understand , you want a coupon code which will hide flat rate shipping, and free shipping will get enabled? Please share some snapshots to clear your view. Aug 27, 2022 at 2:35
  • Actually I edited it. I meant flat rate that is set to $5. Aug 27, 2022 at 2:54
  • got that, now you want to show this flat rate shipping when a desired coupon code matches, else it will remain hidden, right. Aug 27, 2022 at 3:00
  • As of right now it is enabled and showing. But I can adjust to whatever works. But yes, I believe you have the right idea. Aug 27, 2022 at 3:03
  • I want to apply the flat rate shipping only when the coupon code is provided, else, I want it to not be shown. Aug 27, 2022 at 3:05

0

Your Answer

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