Add Item To Cart with Coupon Code

New Member
4 0 0

Hello —

New scripts user here with a client who has newly joined Shopify Plus.

The client likes to offer coupon codes that result in customers receiving a pre-specified free product.

We want to be able to add that free product to the user's checkout once the proper discount code has been added, so that way they can have an exact preview of what they will be receiving. When speaking with Shopify associates regarding upgrading to Plus, they were told that doing this would be fairly straightforward using Shopify Scripts.

As I'm browsing the API and available methods, this doesn't seem to be the case. Am I missing something, and can someone please point me in the right direction?

Many thanks!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
81 0 11

Hey Joseph,

There must have been some confusion; it's currently not possible to add items to a customer's cart.

Guillaume

0 Likes
New Member
4 0 0

@Guillaume — this is troubling, seeing as how we have in writing from the rep that it was indeed possible with a few simple steps in Shopify Scripts.

0 Likes
Shopify Staff
Shopify Staff
81 0 11

Do you recall who you were discussing with? Maybe I could clarify things

0 Likes
Shopify Partner
221 1 15

Hey Joseph,

Well that feature sounds a lot like "buy one get one free" which it is possible with the Script Editor. @Guillaume Correct me if Im wrong, but you could change the product you are giving for free for a product of your choosing. (If its only one product you are giving for free it should be pretty straight forward to change in the script editors code). If you want the customer to choose the product which product they will be getting for free from a collection, you could make a collection of those products and with the script editor catch if they have the necesary products from the correct collections and if conditions are met, apply the discount. This would not be a cupon feature thought, what you are saying is not possible via discount cupon as far as I know. Im trying to do exaclty this for my store as well haha. Im looking into the Script Editor App and taking a look into THIS discount codes, still dunno if I can affect with this how the cupon works. Ill see what I can do with this haha. Sorry for not haveing a straing answer, but im still looking for one too. :P 

Still good luck with the problem men. Ill be sure to post my findings later on.

Cheers! :P

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! :P

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com :D
0 Likes
New Member
4 0 0

@Jurgen — this was confirmed to be not possible (even though our rep stated differently) as we desire – which is adding a product to the cart upon entry of a correct discount code. Not pre-loading the cart with a bonus and then making it free.

0 Likes
Shopify Partner
221 1 15

Joseph,

Bummer D: Have you consider the app "buy one get a free gift"? I know its not exactly what you are looking for, but it helps. This feature is also in the Script Editor App, but you will need to either search for the code or make it yourself :P Well Ill keep digging into the discount code from the Script Editor. What Im actually trying to archive is make a discount code work for 100% of the price on only the first item, of a valid colection, in the cart. The thing with the Script editor is it works between cart changes. Im no Script Editor expert Im acutally staring out, so Im reading all about it to see what I can do. Hope you find a work around :P

Cheers! 

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! :P

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com :D
0 Likes
Shopify Partner
221 1 15

Hey Joseph, 

I see you problem being solve a few diferent ways, maybe not with Shopify discount cupons but with JS coding on the cart and a web service to check if the cupon is valid. You could add a form with a textbox on the cart where the client would put the code and if the code is accepted the JS would add a product with the discount (100%) to the cart automatically. and he would just follow out to the checkout. 

Another way is to generate a cupon worth 0% discount and with the Script Editor Catch when the cupon is made and apply the discount your way. I made this happen on our store an it worked. I discount 100% to 1 quantity of a product which meets the criteria and with the highest price in the cart. You can see the different versions I coded HERE. I you have any questions about the code, please ask away :D Ill be happy to assits to the best of my ability :P Hope this helps! :D 

Good Luck! 

Entrepreneur, Developer, Geek, Gamer and very passionate about WEB development! :P

Need help with your Shopify Store? Contact me: jfeuchter@gmail.com :D
0 Likes