Is it possible to retrieve the tags on a Shopify product from Shopify and use those tags for targeting on the product page?

We are using headless Shopify with a frontend made with Nextjs and have enabled the shopify plugin to connect builder.io to our Shopify account.

We are categorising our products on Shopify using tags. We want to to able to target our CMS data to products from a certain category. For this we would need to target based on the tags. Would it be possible to retrieve these product tags from shopify in builder.io’s targeting options? If yes, how can we achieve that?

Screenshot of an example of the shopify product tags that I am referring to
ShopifyTags

Hi @Raunak,

Yes, it is possible to target your Builder content based on product tags (and vendors like you mentioned in your other forum post) with custom targeting. You can follow the technique outlined in this guide.

Hi @maddy ,

Thank you for your reply!
But the guide which you shared does not really help with what I want to achieve.

So to clarify, I wanted to know if we can pull the vendors (and tags as well if it is possible) directly from shopify and show it in a selection list in the targeting menu on the editing page.

Just like how Builder can directly pull the products and collections from the shopify store and allow us to select the products or collections we want on the targeting menu -

Hi @Raunak,

Thanks for sharing more details! By default, Builder does not pull in tags and vendors like it is done for products and collections and you can’t dynamically create tags unless you were to build a custom plugin. That being said, you could still a have dropdown of tags and vendors to target off of. In Builder, you will need to manually enter the tag or vendor values as targeting options (you can make this targeting attribute have enum values so they display in a list rather than needing to manually type in a tag or vendor each time). Then in your codebase, if tags and vendors are available from an API (I believe they are), you can use the API to dynamically pull in a tag or vendor or hardcode them.

1 Like