Closed ikudosi closed 1 year ago
I'm trying to do the following and it doesn't seem to be doing anything:
await service.productVariant.update(32255644270627, {variant: {id:32255644270627, metafields: [{ namespace: "custom_fields", key: "est_in_stock_date", value: "7/4/2023", type: "single_line_text_field" }]}})
I do get a successful response, though no update occurred when I postman for the metafields on that variant.
I'm looking at the docs and it does seem like you can pass metafields in the variant PUT:
PUT
curl -d '{"variant":{"id":808950810,"metafields":[{"key":"new","value":"newvalue","type":"single_line_text_field","namespace":"global"}]}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2022-10/variants/808950810.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json"
So unfortunately, after testing, it only creates but not updates. The true way to update existing metafields seems to be to have the reference of the actual ID and use the PUT metafields API.
I'm trying to do the following and it doesn't seem to be doing anything:
I do get a successful response, though no update occurred when I postman for the metafields on that variant.
I'm looking at the docs and it does seem like you can pass metafields in the variant
PUT
: