Problem in updating Products and variants through API in Shopify

Shopify provides a cloud platform for e-commerce business. While using Shopify to setup online ecommerce for a reputed industry we found a strange issue which gave us lot of trouble in finding out the root cause. Let us look at the problem in updating Products and variants through API in Shopify and then we move towards the solution of it.

The Problem

We were asked by our client to integrate the Shopify Products with an ERP. We wanted to use our own application APPSeCONNECT which has a generic solution to send batched set of product to Shopify Cloud solution so that when any product gets updated in the ERP we get the same product updated into Shopify. APPSeCONNECT allows mapping data between two types of heterogeneous environment at an interval and generates an XML file which needs to be updated.  But while updating the product with all its variants we see an unexpected result.

As per the documentation, we call the Shopify server using the following url. https://xxxx.myshopify.com/admin/products.xml

We send the data as under:

The process didn’t work and it throws “Unprocessable entry” and the details say “product variant and option are not unique” even though there aren’t any duplicate product in the batch. This seems to us as a Bug in Shopify and we were desperate to find a solution.

The Solution

During trial and error when we send the product without variant, the same endpoint does consume the xml correctly. For instance, if we send:

Product Updating Problem

Here in the xml you can see the Product gets updated but with the Variants it doesn’t.

As we got the product updated successfully, we use a separate API to update the Variants too. We use https://xxxx.myshopify.com/admin/variants.xml to update the Variants and thank god, Shopify does update the Variants too successfully.

So the solution is to update the Variant and the Product separately and the process works like champ.

We hope the solution helps.

Also Read:

Magento Vs Shopify Vs BigCommerce – eCommerce Platform Battle !

Team InSync

We help you operate your online retail business more efficiently by integrating your ERP with your Ecommerce, Marketplace or CRM applications.