How to fill discount code on checkout page automatically in your Shopify website?

ByAdam

How to fill discount code on checkout page automatically in your Shopify website?

Discount codes can only be processed in the checkout. This customization allows users to enter their discount code on the cart page; the discount code is sent into the checkout as a url parameter and automatically applied when the user reaches the first checkout page. Discount code is entered in the cart page.

  • Locate following code in your liquid template

  • Directly below that line of code you need to place something like this:

“RESELLERDISCOUNTCODE” will be your discount code.

  • If you want apply this to only a specific group of customers, use tag for this group and then only apply the code to customers in this group.

Add coupon code from URL

This will allow you to add a coupon code to any URL and populate that coupon code at checkout automatically

  • Locate following code in your cart.liquid template:

  • Directly code below, you need to place something like this:

  • You need to ensure that both jquery and Jquery cookie are contained in your theme. Your theme probably already has jquery so you would just need to include jquery-cookie

Jquery: https://jquery.com/
jquery-cookie: https://github.com/carhartl/jquery-cookie

This Gist should be a solid building block to customize for your specific needs and added at the end of your layout.theme file before your </body> tag and within a script tag <script type=“text/javascript”>

 

About the author

Adam administrator

Leave a Reply