Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Here is my CODE
For Metafields I'm using the MetafieldsGuru App
When I'm doing post request to this it gives me products but with empty metafields
axios
.post(
'https://thirdwavecoffeeroasterscom.myshopify.com/api/2021-10/graphql.json',
{
query: `
query {
products(first:20, query:"tag:bean") {
edges {
node {
id
handle
title
images(first:1, maxWidth:360) {
edges {
node {
src
}
}
}
variants(first:1) {
edges {
node {
id
price
}
}
}
metafields(first: 250) {
edges {
node {
namespace
key
value
}
}
}
}
}
}
}
`
},
{
headers: {
'X-Shopify-Storefront-Access-Token':
'**********MY TOKEN*************',
'Content-Type': 'application/json'
}
}
)
ThankYou!
It looks like you're using the Storefront API (based on the `/api/2021-10/graphql.json` URL). Metafields aren't exposed in the Storefront API by default; they require an extra step to make them visible. If you haven't explicitly done this, then I'm guessing that's the issue.
You can read more at https://shopify.dev/custom-storefronts/products/metafields#expose-metafields
To learn more visit the Shopify Help Center or the Community Blog.
Swalkinshaw,
Thank you for your reply I'm new to graphQL so place can you share GraphQL query for Products with Metafields.
Thank you!