All things Shopify and commerce
Hi!
I wanted to know if is it possible to add/delete a product tag from liquid template. I'm using a custom script in script editor that gives a product for free when cart total reaches X amount, the product I give is selected by product tag, so if it's not possible to change product tag from liquid, could I make any workaround so I can change the tag output in liquid that the script is receiving?
I know it's a bit confusing, but thanks for the help!
Liquid reads from the servers, but doesn't write to it. So it won't be possible for Liquid to remove a tag. Shopfiy Flow has actions that can remove product tags but not sure if that is a valid approach as we're lacking some context.
Why would you need to remove the tag? Is this product that someone gets for free the only one you have?
Also keep in mind that you could have multiple people in the checkout flow with the same item in it. Be sure to consider that in your approach.
Tags would be used to select wich product to give for free, so if the client doesn't want to give that product anymore he would just delete that tag. I'll give a try with Flow.
This is the part of the code where i declare the threshold and the tag i want to use in case you want to take a look.
DISCOUNT01 = [
{
product_selector_match_type: :include,
product_selector_type: :tag,
product_selectors: ["discount1"],
threshold: 4500,
quantity_to_discount: 1,
discount_type: :percent,
discount_amount: 100,
discount_message: 'Spend 4500 and get a free XXX,
},
It looks that for this implementation I might need to use js on liquid or make an app.
Thanks.
Hi,
I'm not sure if you have tried the discount option that Shopify provides "Buy X get Y". Maybe it can suit your case..
https://shopify.com/admin/discounts/new
I'm using script editor because it's a multiple threshold gift. So that won't help me, but thanks anyway!
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024