Liquid, JavaScript, themes, sales channels
Hi,
Im trying to recreate the filter by tags functionailty that Shopify have so brilliantly removed.
I need to get a list of all the available tags within the current filtered collection but not sure on the best way to do this.
collection.all_tags - gets all the available tags but this includes tags from products which have been filtered.
current_tags - gets all the active filters
I thought Id be able to test if the tag was in collection.all_tags and then test if it wasnt in current_tags but this doesnt work as I need because some of the avilable filters should be removed when certain products are filtered but they still seem to appear.
eg, I have 3 products with the following tags
product 1 - Tag A, Tag B, Tag C
product 2 - Tag A, Tag B, Tag D
product 3 - Tag C, Tag D, Tag E
If I click on my filter to select only the products which have Tag A it displays product 1 and 2 in the list but still has the option to filter by Tag E which is no longer a valid filter as none of the displayed products have Tag E.
collection.all_tags will contain: Tag A, B, C, D, and E
currrent_tags will contain: Tag A
Is there an equivilant that will contain only: Tag A,B,C,and D as these will be the remaining valid tags which are assigned to the visible products?
Hope Ive managed to eamplain that clearly
Thanks
After no help from Shopify Pro support (other than advice to buy a paid app) I found an external website that told me to use this which seems to work.
collection.tags
Hope that helps sombody else
Thanks for the fix!
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024