Ad

In Shopify, How Do I Output Multi-word Product Tags?

- 1 answer

I'm creating a breadcrumb in Shopify, and using filtered_tag_array.first to display product tags in the breadcrumb. However, some of my product tags are more than one word - for example "for the buffet". Using the "filtered_tag_array.first" code, only the word "for" displays if I am pulling up "for the buffet". One option that works is changing the product tags to have dashes in them, but that doesn't look as nice in the breadcrumb. Is there a way I can code it so I can display multi-word product tags in the breadcrumb without adding dashes?

Ad

Answer

You could use dashes in your product tags and replace them with spaces in the breadcrumb.

E.g.

{{ tag | replace: '-', ' ' }}
Ad
source: stackoverflow.com
Ad