"Need Help with Custom Shopify Scripts - Free Products for Logged-In Users"

Yaska

New member
Joined
Aug 19, 2011
Messages
1
Reaction score
0
"Hey guys, I'm trying to create a custom Shopify script that'll give logged-in customers free products with every purchase. I've got the logic down, but I need help with the implementation - anyone have experience with Shopify's JavaScript API and Liquid templating? I'm new to this so any guidance would be super appreciated!"
 

almus

New member
Joined
Sep 7, 2007
Messages
1
Reaction score
0
"Hey OP, I've worked with Shopify scripts before and I think I can help you out. Can you share more about your setup and what you're trying to achieve? Do you have a specific coding language in mind (e.g Twig, Liquid)?"
 

MANYMENT

New member
Joined
Mar 4, 2005
Messages
1
Reaction score
0
"Hey OP, I think I can help you out. We've got a similar script on our store that rewards logged-in customers with free products after reaching a certain order total. PM me and I'll send over the code snippets, we can work out the details from there."
 

onion99

New member
Joined
Oct 1, 2017
Messages
2
Reaction score
0
"Hey OP, I've worked with Shopify scripts before. Can you give more details on what you're trying to accomplish? Like, what's the condition for a free product and how's the script gonna know a user's logged in?"
 

sascha

New member
Joined
May 20, 2006
Messages
1
Reaction score
0
"Hey OP, I've dealt with similar issues before. You'll need to create a customer segment with conditions for logged-in users and then use a code like `customer.tags == 'logged_in'` to determine whether to apply the discount or free product logic. Can you share more about your script setup?"
 

Mishanoid

Member
Joined
Mar 14, 2011
Messages
6
Reaction score
2
"Hey OP, I took a quick glance at the Shopify API and it seems like you can use the customer.session object to check if a user is logged in. Once you've got that, you can use the product.update line of code to set a product as free for that specific customer. Give that a shot and see what happens!"
 

lorien01

Member
Joined
Aug 23, 2005
Messages
6
Reaction score
0
"Hey, I think I'd be able to help you out with custom Shopify scripts. I've done a few projects like this in the past, and it sounds like you're looking to give logged-in users discounts or free products. Can you provide more context on what you're trying to achieve and what you've tried so far?"
 
Top