Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hey guys I'm trying to filter products by tag name but its not working:
{
collections(first:100){
nodes{
products(filters:[{tag:"Abstract"}],first:100){
nodes{
title
tags
}
}
}
}
}
it still returns full list of products
Solved! Go to the solution
This is an accepted solution.
Hey @Tsredi ,
Just taking a look here. The first thing I would check is to make sure you've met the requirements for filtering products on the storefront API. What stands out to me is the requirement to install the Search and Discovery app to enable the additional filters. Without that, the filter arguments would be ignored.
Hope that helps!
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi there 👋
If you are using the Admin API or Storefront API you can specify the tag in the query param. It would look something like this.
{
products(first: 10, query:"tag:Premium") {
nodes {
id
handle
}
}
}
If you are trying to build a filtering experience with the storefront API, and not just retrieve products with a certain tag, I would recommend reviewing this in depth tutorial on filtering products.
To learn more visit the Shopify Help Center or the Community Blog.
Hey, I know that it works that way but I'm trying to filter products under collections
@Tsredi wrote:Hey, I know that it works that way but I'm trying to filter products under collections
This is an accepted solution.
Hey @Tsredi ,
Just taking a look here. The first thing I would check is to make sure you've met the requirements for filtering products on the storefront API. What stands out to me is the requirement to install the Search and Discovery app to enable the additional filters. Without that, the filter arguments would be ignored.
Hope that helps!
- Kyle G.
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks, that's what I was missing