Automatic addition of a discount code before checkout

Shopify Partner
3 0 0


I want everyone who goes to checkout to have the FREE GIFT discount code added. I managed to achieve this using the app, however, I have to select a code in the pop-up that does not visually match the store. Is it possible to add the code automatically using a script or is there an application that will add the code without displaying any information about it?

I would prefer to write a script, but I need someone to direct me how to do it.

Replies 3 (3)

Shopify Partner
178 18 30

Hello @mrycko,


Thanks for being part of the Shopify community! A discount code is a great way to increase sales and convert non-believers into clear customers. Could you confirm that you want to apply the discount code in the Cart, so people will see it before going to the Checkout?



Did you find my response useful? Mark it as "Accepted solution" so others can see it, or just like it.
Shopify Partner
3 0 0

I don't have a discount entry in my cart. It is not necessary to show the discount in the cart.

My discount code can be added to each order. There will be validation at checkout that targets specific customer segments that First_order_date IS NULL. At checkout, after entering your email, Shopify will automatically reject the code for emails from which a purchase has already been made.

Therefore, it is important that the code is active immediately after entering checkout. How and where it will be added does not matter. Before proceeding to checkout, the user does not need to know about it.

Shopify Partner
1764 142 187

Hi @mrycko ,


you can write a custom script which will add discount code to every user which will have the discount criteria in admin.


please find the URL to implement discount code on page load


hope this will help…

For any custom development WhatsApp or connect at Email ID: for quick consultation. | Shopify Free codes
To support Buy Me a Coffee