Liquid, JavaScript, themes, sales channels
Hi,
I am trying to add product tags to the actual product pages to increase internal links.
I do use a lot of tags in conjunction with other apps that I dont want customers to see.
I currently have (found) the following code which I have tested as working -
<div class="product-tags">
{% assign exclude_tags = "CAZAAR,not-on-sale" | split: ',' %}
<p><strong>tags:</strong>
{% for tag in product.tags %}
{% if exclude_tags contains tag %}
{% continue %}
{% endif %}
<a href="/collections/all/{{ tag | handleize }}?sort_by=best-selling">{{ tag | handleize }}{% unless forloop.last %}{% endunless %}</a>
{% endfor %}
</p>
</div>
This ensures CAZAAR & not-on-sale tags dont show.
Every product also has a tag starting with BRAND_<the brand>, is there anyway I can stop all of these tags showing but just stating the start, i.e. all tags starting with BRAND_ should not display.
I found this code, but I couldnt get it to work (maybe I was placing it in the code above incorrectly?)
{% assign prefix = tag | slice: 0 %}
{% if prefix == 'BRAND' %}
{% continue %}
{% endif %}
Lastly, I have noticed with the first code above, if a tag has a space like - 'pre order' as an example, this would just show the tag 'pre' - is there any way to fix this?
Many thanks
Mike
User | RANK |
---|---|
37 | |
29 | |
12 | |
12 | |
8 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023