How to Apply discount code to Shopify Stores Automatically

Stores are offering marvellous discount codes, but lots of these codes end up lost maybe the customer forgot the code and left the cart, maybe the copy coupon code functionality didn’t work, or something else. In the end, it leads to a bad customer experience.

If you automatically apply this discount code to the cart, it makes the whole process much easier for the customer and converts a troublesome journey into a seamless experience, they can take advantage of this code easily and buy quickly.

Let’s see how we can achieve this easily, (Doesn’t Require any Prior Coding Knowledge)

  • Starting from zero, Create a Discount Code which will be applied to the cart.
  • Now, Put the discount code in the following format (replace yoursite.com with your Shopify site URL and DISCOUNT_CODE_HERE with the coupon code you want to apply)
https://yoursite.com/discount/DISCOUNT_CODE_HERE
  • WOOHOO :), That’s IT. Now, When the customer clicks the button they will be taken to the link and the discount will be automatically applied to their cart
  • If you want to add some params to the URL you can do it like this
https://yoursite.com/discount/DISCOUNT_CODE_HERE?a=b&c=d
  • What if we want to redirect the user to some other page rather than the homepage, we can do this by putting a param redirect in the URL, with the handle of the page as the value. E.g. below,
https://yoursite.com/discount/DISCOUNT_CODE_HERE?redirect=/my-other-product

Troubleshooting

  1. If you test your link and it does not properly apply your discount code, you likely need to adjust the added parameter so that it starts with “&” instead of “?”. This is because “?” only works when your discount is the only parameter you’re adding to your link, and if you’re adding multiple parameters, you’ll need to use “&”. Change your link format to the following and it should work:

mysite.com/discount/coupon_code?redirect=/new-path

2. Custom Checkout Apps sometimes do not support this. Contact the app developer if this doesn’t work on a particular checkout but works on Shopify checkout.

Further Reading

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store