Hi folks,
I need to delete previous product variant from the existing product and add new variant using API. I am facing issue while adding multiple variant to an existing product. Below is the code what I am trying
$access_token = 'xxxxxxxxx';
$curl_url = 'https://example.myshopify.com/admin/api/2019-04/products/3856519725165/variants.json?access_token='....;
$variant = array( "variant" => array(
Hey @bajwa_rajat ,
You need to remove all the previous variant using API and then add new variants. This is the way I achieved.
@iamdeepakbasnal , I have used another aproach . I have updated the product using PUT api of product and send array of all varinats and it worked. But now I am facing a problem, all varinats created in PUT request have inventory 0 , I want to set any parameter in my request which disable inventory tracking for new created varinats. IS this possible ?
Or any alternate solution ?
@bajwa_rajat
Creating a variant with
"inventory_policy": "continue"
will allow a product to continue to be sold even after the inventory dips below 0.
Alternatively, creating a variant where "inventory_management"=>nil will tell Shopify that the inventory doesn't need to be tracked.
check in this Variant API Doc as well.
Thanks @Muhammad_Asfar , It worked.
But now I have another case . I want to set inventory quantity of varinats , using Product PUT api. How to achieve this ?
User | Count |
---|---|
12 | |
12 | |
7 | |
6 | |
4 |