I am making an API for Shopify with PHP, I want to update inventory_quantity
of a product, this is my product in JSON
"variants": [
{
"id": 1234567890123,
"product_id": 9876543210987,
"title": "25",
"price": "111.00",
"sku": "000003",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": "123.00",
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "25",
"option2": null,
"option3": null,
"created_at": "2020-01-01T11:35:46-05:00",
"updated_at": "2021-01-02T15:25:14-05:00",
"taxable": true,
"barcode": "",
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "kg",
"inventory_item_id": 54789632568754,
"inventory_quantity": 1,
"old_inventory_quantity": 1,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/1234567890123"
}
]
and I'm using the following code in PHP, but it doesn't work for me
$my_location_id = 00000000001;
$array = array(
"variant" =>
array(
"location_id" => $my_location_id,
"inventory_item_id" => 39987147145391,
"inventory_quantity" => 13
)
);
$my_tocket = "shpat_5abcdfghyisjdjdjdjdjskdj123456a";
$my_shop = "mi_tiendita_shopyfy.com";
$products = shopify_call($my_tocket,$shop_url,"/admin/api/2020-
10/inventory_levels/adjust.json",$array,"PUT");
I don't know if the instruction is correct, or what I'm doing wrong.
I wish you could help me.
Regards.
question from:
https://stackoverflow.com/questions/65621746/update-inventory-in-shopify-with-php-shopify-call 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…