Change product tags from liquid

alex2287
Tourist
5 0 0

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!

Replies 4 (4)

Jason
Shopify Expert
11190 225 2282

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.

★ I jump on these forums in my free time to help and share some insights. Not looking to be hired, and not looking for work. http://freakdesign.com.au ★
alex2287
Tourist
5 0 0

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.

alvinkonda
Shopify Partner
48 6 14

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

 

 

KondaSoft.com - Premium Shopify themes that are simple to use, easy to customize, and awesome to your visitors.
alex2287
Tourist
5 0 0

I'm using script editor because it's a multiple threshold gift. So that won't help me, but thanks anyway!