We're making changes to how variants are matched with options when products are updated.
API
Effective June 03, 2019
We're making a change to how variants are matched based on any given options when you update products. Although we don't expect this change to impact existing apps, please review the following information to make sure that your own apps don't include any use cases that might be affected.
Currently, our Product Update endpoint takes a variant ID as an optional argument when you update a variant. If you provide an ID in your request, then the existing variant with that matching ID is updated as expected. However, if you don't provide a variant ID, then Shopify will attempt to search for the variant that you want to update based on matching on the options provided (such as "option1": "Small"). If we find a matching variant with all of the provided options, then we delete the existing variant, and create a new variant with all the previous and newly updated information from the API call. This results in a new variant with a unique ID.
The following example shows a product update API call where a variant ID isn’t supplied:
PUT /admin/api/2019-04/products/#{product_id}.json
{
"product": {
"id": 632910392,
"variants": [
{
"sku": "Updating the Product SKU",
"option1": "Small" # we will attempt to match any variant with this option.
} ]
}
}
What’s changing?
As of June 3, 2019, if you don’t pass a variant ID in a product update API call, then we will update the related variant if it matches the provided options rather than deleting it and creating a new one. The variant that's returned in the product update call will have the same ID as the previously existing one, rather than a new ID. If we can't determine a match based on the provided options, then a new variant is created with a unique ID.
From an API point of view, the variant returned in the product update call will have the same ID as the previously existing one, rather than a new ID.
We do not expect this to have any negative impact on existing apps. However, if you have any concerns or questions about this change, then contact us through your Partner Dashboard or in our API forums.