Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Product Variant Metafields are not being updated on a PUT by Tom D.

$
0
0

I am sending PUT requests to the /products API to update the Product and its Variants at the same time (ie - one API call).  Both the Product and Variants have metafields which I am passing as part of the API call.  

The issue I am running into is the Product Variant metafields are not being updated if they already exist.  I always pass the existing Metafield ID as part of the call so Shopify should be able to find and update the Metafield.  If I don't pass the ID, Shopify complains about non-unique Metafields.

Here is a sample request, truncated for brevity and to highlight how I am passing the Metafields:

{"product": {"id": 12345,"title": "Some title","variants": [
      {"sku": "some-sku","metafields": [
          {"namespace": "omx","key": "Full Price","value": "50","value_type": "string","id": 3456
          },
          ...
        ],"position": "1","id": 2345
      }
    ],
    ...
  }
}

This seems like a bug with the API - should I open a support request with Shopify?

I know there is a separate Metafield API, but given the volume of products in this store it would take days to run a full update if I have to update each metafield one by one so that is not an option.

Thanks,

Tom


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>