1
votes

I'm trying to update existing variants on an product.

To do this, first I need to delete all existing variants due to race condition issues on the API side that I won't go into here but are outlined here: https://groups.google.com/group/shopify-app-discuss/tree/browse_frm/month/2011-12/927b3c41f7effb44?rnum=231&_done=%2Fgroup%2Fshopify-app-discuss%2Fbrowse_frm%2Fmonth%2F2011-12%3Ffwc%3D1%26

I get HTTP response code 423 (Locked) when I try to delete a variant. I'm using the Shopify Ruby gem v3.0.3 fyi. But I can delete the product and create everything from scratch, not ideal.

Why would deleting a variant be locked but not deleting a product?

shopify_product = ShopifyAPI::Product.find(id)
shopify_product.variants.each{|v| v.destroy}
1

1 Answers

1
votes

Every product in Shopify must have at least 1 variant. If you try to delete the only variant that a product has, Shopify will return with a 423 response code.