Adding specifc product tag to cart line items

jdashley
Shopify Partner
7 0 3

Hello All!

We have a lead time message based on specific tags that displays for certain products on the product page. For example, someone clicks on bowl in on a collection page and that bowl has a lead time of 1-2 weeks from purchase date, a message will appear above the Add to Cart button that reads, "lead time is approximately 1-2 weeks". That is generated with if statements in the product template stating that if a product has the tag "LT12" display that message. We have several others based on the lead time (4-6 weeks, 8-10 weeks, etc), all done by tags. We would love to add that to the line items on the cart page too so it displays just below the item name.

*** Figured it out. I had something above the code written incorrectly. Oopsie! Tried to delete post but couldn't.

 

 

 

0 Likes
LuckyNigam
Excursionist
34 2 6

Hi @jdashley 

I understand your requirement I think you want delivery time on the basis of tag. Use this code on product-template.liquid fille within the form tag. It may be helpful for you

{% if product.tags contains 'LT12' %}

<input type="hidden" id="deliveyDate" name="properties[Delivery]" value="1-2 weeks" />

<label for="deliveyDate">1-2 weeks</label>

{% elsif product.tags contains 'LT46' %}

<input type="hidden" id="deliveyDate" name="properties[Delivery]" value="4 - 6 weeks" />

<label for="deliveyDate">4 - 6 weeks</label>

{% elsif product.tags contains 'LT810' %}

<input type="hidden" id="deliveyDate" name="properties[Delivery]" value="8 - 10 weeks" />

<label for="deliveyDate">8 - 10 weeks</label>

{% else %}

{% endif %}

 

Thanks

 

 

0 Likes