Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

REST API - Metafield value for individual product

Solved

REST API - Metafield value for individual product

ahamad786moin
Visitor
2 0 0

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.

Moin Ahamad
Accepted Solution (1)

lastiri
Shopify Staff
6 4 3

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

View solution in original post

Replies 2 (2)

lastiri
Shopify Staff
6 4 3

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

MetafieldsGuru
Shopify Partner
160 32 104

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

Check out Metafields Guru, the #1 ranked metafields app.

Bulk editor | Data import/export | Metafield sets | Browser extension