Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I want to update multiple metafields of product which is shown at my web site at one api call.
Url : https://{...}:{...}@{...}myshopify.com/admin/api/2021-07/products/{productID}/metafields.json
const metafieldParam = {
metafield(s) : [
{
namespace : "Urls",
key : "image",
value : "",
type :
},
{
namespace : "Urls",
key : "video",
value : "",
type : "",
},
{
....
},
]
}
await fetch(url, {method : 'POST' , headers : {'Content-Type' : 'application/json', body:JSON.stringify(metafieldParam)})
but I get 400 bad request from shopify.
If I send request by only one param ( ex : param = {metafield : { namespace : ... } } , It succeeds to update, but I want to update all metafields at one fetch call. Is this possible?
I tried these...
1. metafield(s)
2. param = { product : { metafields : { .... } } },
3. param = { product { id : product_id ,{ metafields : { .... } } }
4. PUT
5. POST
6. in url 2022-07
I appreciate your help !!!!
It's not possible to update multiple metafields at once. You will need to make a separate API call for each metafield you want to update.
Hi,
Is it possible to create multiple meta fields with the same key?
your help would be appreciated!!.
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025