1

I want to know if we can pre populate the discount code in the checkout/cart page when customer clicks a button from a page.

Aim is when customer clicks a button from a page it should redirect them to checkout/cart with the product in cart (could grab it from the session) but I want to apply a discount code at same time

Is this possible

0

I haven't tried this myself but apparently is a feature of m2.

https://github.com/magento/magento2/issues/527

  • Create a price rule with a specific coupon code

  • Use a URL link in the format:

http://example.com/index.php/checkout/cart/CouponPost/coupon_code/couponcode

  • Replace example.com and couponcode in the URL with your values

Although item needs to be in cart. Wasn't sure that meets your requirements.

| improve this answer | |
  • Hi @dominic I have read this but not sure would this work or how to even implement – Jack Brooks May 29 '19 at 21:47
0

The other answer here points to a Magento issue that was supposedly implemented, but I've never seen it anywhere in the admin, and people are commenting on that github issue much to the same effect.

I actually wrote a (free and open source) module that should do exactly what you need. You can find it here: https://github.com/crankycyclops/DiscountCodeUrl

It's a relatively new project and still needs more testing, but it's working well for me so far. It's been tested against 2.3, but should also work on 2.2 (if it doesn't and you need it to, go ahead and file a Github issue and I'll take a look.)

| improve this answer | |

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.