Adding free gift to cart when checkout total is more than $25

Solved
Alice6860
New Member
4 0 0

Hi @PaulNewton thanks for your reply - unfortunately I do not have plus plan.

0 Likes
PaulNewton
Shopify Partner
2579 134 440

Then you will need to either set the free gift to be $0, or make an automatic discount code that will make it $0 which means customers will not be able to use other discounts. 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Lauren606
New Member
1 0 0

Hi @jayanetty , can you instruct how to add free product when the customers purchase specific group of product? 

Thank you for your blog!

 
 
 
 
0 Likes
misssusyramos
New Member
1 0 0

I have the same concern 

0 Likes
steve79
Tourist
5 0 1

Quick question. Iʻm not on the Plus plan but got the code (Follow this, https://jayanetty.com/blog/give-free-product-using-shopify-script-editor/) to work by making the price $0. BUT, when I tested the code I noticed that if the price in the cart falls below my threshold-$100 in my case- the FREE product remains in the cart. Is there a way to prevent this?

 

thx.

 

~steve

0 Likes
jayanetty
Pathfinder
115 12 34

Hi @steve79 Glad that helped. Yes there is a way to prevent it.

Add this to the else condition.
cartUpdates = { {{ variant_id }}: 0 }

and wrap the whole code inside a session key. This is to break the loop.

So basically, remove the session key whenever a href/button is clicked, and add the session key when the script is run once. Hope this helps

0 Likes
steve79
Tourist
5 0 1

Not sure how to wrap the whole code in a session key. A little help would be great.

 

I know enough about coding to fix minor things, but things can get dangerous very quickly. 

0 Likes
PaulNewton
Shopify Partner
2579 134 440

@steve79 wrote:

Quick question. Iʻm not on the Plus plan but got the code (Follow this, https://jayanetty.com/blog/give-free-product-using-shopify-script-editor/) to work by making the price $0. BUT, when I tested the code I noticed that if the price in the cart falls below my threshold-$100 in my case- the FREE product remains in the cart. Is there a way to prevent this?


You need to try and evaluate what the final price would be BEFORE you actually apply the discount then skip it when it's below your threshold.

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
steve79
Tourist
5 0 1

Hi. Can you let me know how to wrap the whole code inside a session key?

I donʻt have enough coding knowledge to do this.

Thanks.

0 Likes
Alyaana
New Member
2 0 0

Hello @jayanetty 

Love the way in which you have simplified the whole scripting task. Even for a non-developer like myself.

I was looking to add a gift as soon as a product is selected. Have marked the gift a 0$ in my product.

I tried to update it for my store but couldnt seem to make it work. Also, Do I need the script editor if, I set the product price as 0$?

P.S: I checked in my Theme.liquid and found that jQuery library is available.

Cheers,

Alyaana

0 Likes