A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi,
I'm trying to get the metafield value specific to a product using REST API. I'm using https://<store-endpoint>/admin/api/2022-01/metafields.json and I'm not getting any metafield that I created on Product object.
Can someone please help me in this.
Solved! Go to the solution
This is an accepted solution.
Hello Ahamad786moin,
The endpoint you provided would give you all the metafields that are associated to the Shop resource.
In your case, if you want to get the metafields for a specific product you can do so by using:
https://<store_endpoint>/admin/api/2022-01/products/<product_id>/metafields.json
Furthermore if you know the specific product_id and the metafield_id you can use:
https://<store_endpoint>/admin/api/2022-01/products/<product_id>/metafields/<metafield_id>.json
Hopefully that helps
Rafa L | Shopify
- Was my reply helpful? Click Like to let me 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
This is an accepted solution.
Hello Ahamad786moin,
The endpoint you provided would give you all the metafields that are associated to the Shop resource.
In your case, if you want to get the metafields for a specific product you can do so by using:
https://<store_endpoint>/admin/api/2022-01/products/<product_id>/metafields.json
Furthermore if you know the specific product_id and the metafield_id you can use:
https://<store_endpoint>/admin/api/2022-01/products/<product_id>/metafields/<metafield_id>.json
Hopefully that helps
Rafa L | Shopify
- Was my reply helpful? Click Like to let me 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 Ahamad,
Sasha here from Metafields Guru team.
I'm jumping in to specify that you can retrieve the list of the metafields for specific product with the following request:
https://<shop-domain>/admin/products/<product-id>/metafields.json
This request returns first 50 metafield records. If you'd like to retrieve more than 50 metafields, you can either use the pagination or increase the limit from 50 to 250.
Best regards,
Sasha Kachkovskyi
Co-founder and CEO
256 Development