Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hi,
I have uploaded 18K products with custome SEO description. Now I would like to change/improve the SEO description using REST API. I had a look in to the documentations but I could not figure it out.
This is the call I am making for product id 6155434229913:
https://XXXXX.myshopify.com/admin/api/2021-01/products/6155434229913/metafields.json
I am using PUT request sending following JSON:
{
product
{
description_tag = seoDescription
}
}
But the SEO description is not getting updated. Please let me know what I am doing wrong here.
Thanks
Solved! Go to the solution
This is an accepted solution.
Hi,
Using rest api it will be like this:
1. Get the metafields of the product: https://XXXXX.myshopify.com/admin/api/2021-01/products/6155434229913/metafields.json
2. Filter the metafields above with namespace="global" and key="description_tag"
3. If you have found the metafield in the step above, update the value with the new SEO description_tag
4. Update using this endpoint => https://shopify.dev/docs/admin-api/rest/reference/metafield#update-2021-01, use the existing metafield id from above
5. If the metafield has not been found at step 2, then create a new one https://shopify.dev/docs/admin-api/rest/reference/metafield#create-2021-01 (Create a new metafield for a Product resource)
That's it.
This is an accepted solution.
Hi,
Using rest api it will be like this:
1. Get the metafields of the product: https://XXXXX.myshopify.com/admin/api/2021-01/products/6155434229913/metafields.json
2. Filter the metafields above with namespace="global" and key="description_tag"
3. If you have found the metafield in the step above, update the value with the new SEO description_tag
4. Update using this endpoint => https://shopify.dev/docs/admin-api/rest/reference/metafield#update-2021-01, use the existing metafield id from above
5. If the metafield has not been found at step 2, then create a new one https://shopify.dev/docs/admin-api/rest/reference/metafield#create-2021-01 (Create a new metafield for a Product resource)
That's it.
Hi,
I manage to get it working.
Need to get Meta ID first, then use PUT requests to update Meta description.
Thanks