Add Discount Field On Shopify Cart Without Apps [NEW]

Elghorfi Mohamed
3 min readFeb 2, 2023

Many of you has read my previous article regarding adding Discount Field On Shopify Cart Without using an application (Below the link if you haven’t read it yet).

Later on, Shopify released a new update changes on how they handle their checkout, that’s why for some stores that method couldn’t work. I am sharing with you today a new way that will work for these stores.

For more details, read my other article.

Photo by James Harrison on Unsplash

The first thing we need to do is to locate the liquid file that contains the code of your cart page.

#Locate Cart Template

  • From your Shopify admin, go to Online Store > Themes.
  • Find the theme you want to edit, and then click Actions > Edit code.
  • In the Sections directory, click cart-template.liquid Or main-cart-footer.liquid. This varies from theme to another, try to identify the file in sections folder, it might be the word cart mentioned on it. Else you can reach out, I can help you to identify it with you.
  • Copy/paste the code below anywhere you want to add the discount input to your cart.
    {% render 'snippet-gf-discount-code-updated' %}

#Create Snippet File

  • On the popup, type the name ‘snippet-gf-discount-code-updated’ as below
  • Copy the code below or from here and paste it into the files we’ve just created in the previous step.

That’s it, now you can go to the cart page and test your discount form.

One last thing you need to do, on the JS code, change the totalCartSelector to match your theme.

PS: If this method doesn’t work for your store, try the other method I shared before. Else, you can reach out to me, so I can help you!

Again, this is just to make it work for you, you can still refactor the code and adapt it to your needs.

#Video Tutorial

#Video Demo

So, this is the end of our article today, I hope you learned something from it.
Have a wonderful, great day. Don’t hesitate to contact me if you have any questions. If you face any issues with adding it, you can reach out to me.

Follow me for more:

If you want me to do that for you, from here.

If you like this article, Buy Me a Coffee, Maybe?

Buy Me a Coffee?

--

--

Elghorfi Mohamed

Frontend || Shopify Expert Developer || Shopify Consulting