Removing commas from data.tags

JoshSpires
Tourist
13 0 1

I am displaying product tags as a class to filter what products customers see based on what type of customer they are.

 

As the website is using Boost Commerce filter system (example file can be found here) I have to use data.tags to pull the tags through and display them. The issue with this is that it displays all the tags without spaces and commas in between, so like this DJI,drone,commercial.

Is there away to remove the commas and replace them with spaces?

Josh Spires
Replies 2 (2)

Propero
Shopify Partner
895 101 160

@JoshSpires ,

You may try the replace filter in array while assigning

{{ product.tags | replace: ','  , ' ' }}
- Was my reply helpful? Click Like or Click Accept as Solution
To hire: email us at shopify@propero.in
checkout our app https://apps.shopify.com/picamaze

Nancy_Drake
Shopify Partner
169 9 19

Hello @JoshSpires 

Does this app have the function to transform the comma into space? You can try the Collection Filter & Search Bar app in an unpublished duplicated theme. It allows you to transform the product attributes for the search and filter without changing the Shopify data. You can also copy the product tags to metafields in list form and filter by metafields.

It also has the Merchandising rule to show the products for specific customer groups (based on product tags, metafield, options, collection, type).

AI Search & Product Filter | SB - Check out our Shopify search and filter app to drive more sales