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!

0 Likes
Jason
Shopify Expert
10272 144 1943

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 to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
alvinkonda
Shopify Partner
44 5 9

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

 

 

FireTheme.com - The Best Free Shopify Theme To Increase Conversion Rates (CVR)
Increase your store conversion rates (CVR) and average order value (AOV) with FireTheme, the world's most-loved Free Shopify Theme. Developed for maximum performance, flexibility in mind, and simplicity at core, you can be 100% sure that...
0 Likes
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!

0 Likes
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.

0 Likes