I am filtering my products based on tags. I also want to include product's SEO description in that.
The description that I get from GraphQL query is the entire description that is listed on the full page of the product.
Using
Below is my QUERY ->
graphQLquery11 = """ {
products(first:1, query:"tag:[%s, %s]") {
edges {
node {
id
title
description
seo {
description
title
}
metafields(first:100){
edges
{
node{
namespace
key
value
}
}
}
onlineStoreUrl
}
}
}
}"""%('0-12', 'physical')
This gives me an error
Field 'seo' doesn't exist on type 'Product'
If I remove SEO node from the query and run only metafields I receive this for metafield
"metafields": {"edges": []}
Is there any way to fetch the SEO while fetching the products?
Here is what I want to do illustrated in liqiud - https://shopify.dev/docs/themes/liquid/reference/objects/page-description
But I can not find any such reference for GraphQL
Solved! Go to the solution
Hi there!
The query mostly works but I had to change your product query to be:
products(first:1, query:"tag:%s AND tag:%s")
Give that a try and let me know if it works for you too.
This is an accepted solution.
Resolved the issue on my own
Here is the Updated QUERY
Also keep in mind that I have to use ADMIN API for this(to get metafields)
graphQLquery11 = """ {
products(first:1, query:"tag:[%s, %s]") {
edges {
node {
id
title
description
onlineStoreUrl
metafields(first:1)
{
edges{
node{
value
}
}
}
}
}
}
}"""%('0-12', 'physical')
User | Count |
---|---|
13 | |
12 | |
10 | |
8 | |
7 |