Access a community of over 900,000 Shopify Merchants and Partners and engage in meaningful conversations with your peers.
Hi
I am not much of a coder, but am in need of a very time critical change
I have had to change the architecture of my site last minute, and now my front page collection (only has 3 products) needs to link to a unique collection of products rather than a product
I thought the easiest way to do this (as its very static) would be to create an if statement and use product tags
see below
{% if item.product.tag == littlehands %}
<a class="grid-view-item__link" href="https://inspirebookbox.com.au/collections/our-little-hands-0-2-inspire-book-box">
<img src="https://cdn.shopify.com/s/files/1/1996/3231/files/Select.jpg?14969197971242235864"/> </a>
{% endif %}
{% if item.product.tag == bighands %}
<a class="grid-view-item__link" href="https://inspirebookbox.com.au/collections/our-big-hands-3-6-inspire-book-box">
<img src="https://cdn.shopify.com/s/files/1/1996/3231/files/Select.jpg?14969197971242235864"/> </a>
{% endif %}
{% if item.product.tag == family %}
<a class="grid-view-item__link" href="https://inspirebookbox.com.au/collections/our-big-hands-3-6-inspire-book-box">
<img src="https://cdn.shopify.com/s/files/1/1996/3231/files/Select.jpg?14969197971242235864"/> </a>
{% endif %}
</div>
However the outcome is 3 buttons linking to 3 different areas instead of 1.
Try something more like:
{% if item.product.tags contains "littlehands" %}
...
Thanks Jason
I sorted it out, needed a for loop first, and then the if's off the results of the for.
Hi Roxanne,
I think I am attempting to do a simliar thing, but can't figure it out. Can you share the code you wrote with the loop to do this, thank you!
This works
I put this in the product-template.liquid code and am using App metafield guru to set the message I want in the product.metafields.Info.Shipping field of the product metafield
{% assign has_delivery_tag = false %}
{% for tag in item.product.tags %}
{{tag}}
{% if tag == 'Delivery' %}
{% assign has_delivery_tag = true %}
{% break %}
{% endif %}
{% endfor %}
{% if has_delivery_tag == false %}
<h6><p style="color:purple;font-size: 22px">Delivery Information:-<BR>
{{ product.metafields.Info.Shipping }} </p></h6></style>
{% endif %}
User | RANK |
---|---|
156 | |
95 | |
65 | |
58 | |
49 |
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By