UPDATE PRODUCT
$url = "https://yourdomain.com/api/commerce/products/PRODUCT_ID";
$authKey = "your_authorization_token_here";
$productData = [
"id" => 479077,
"name" => "Basketballshoesconverseallstarbbprototypecx",
"title" => "Basketball shoes Converse All Star BB Prototype CX",
"type" => 1298,
"access" => true,
"description" => "<p>Sneakers Converse All Star BB Prototype CX — Basketball shoes...</p>",
"short_description" => "",
"sku" => "AO2515C",
"sku_show" => 0,
"price" => "3000",
"currency" => "UAH",
"regular_price" => "5760",
"price_for" => "0",
"stock_quantity" => 0,
"stock_status" => 0,
"weight" => 0,
"weight_units" => 0,
"dimensions" => [
"length" => 0,
"width" => 0,
"height" => 0,
"units" => "0",
],
"categories" => [
["id" => 30519, "name" => null],
],
"tags" => "tag1, tag2",
"images" => [
"0" => "-uploadshopcat-s16572/479077/479077_1.webp",
"1" => "https:
],
"images_replace" => false,
"images_skip_index" => false,
"images_replace_new_index" => false,
"variations_only_update" => false,
"variations" => [
[
"priority" => 0,
"id" => 736413,
"sku" => "SKU1234",
"title" => "42",
"status" => "true",
"description" => "",
"stock_status" => 0,
"show_stock" => 0,
"instock" => 10,
"image_num" => 0,
"price" => "+100",
"price_old" => "120",
"price_cost" => "80",
"bulk_prices" => [
[
"moq" => 10,
"price" => 5000
],
[
"moq" => 15,
"price" => 4500
],
],
"dimensions" => [
"length" => 0,
"width" => 0,
"height" => 0,
"units" => 0,
],
],
[
"priority" => 0,
"title" => "43",
"description" => "",
"stock_status" => 0,
"show_stock" => 1,
"instock" => 1,
"image_num" => 2,
"price" => "+100",
"price_old" => "120",
"price_cost" => "80",
"bulk_prices" => [
["moq" => 10, "price" => 5000],
["moq" => 15, "price" => 4500],
],
"dimensions" => [
"length" => 0,
"width" => 0,
"height" => 0,
"units" => 0,
],
],
],
"products_synonyms" => "",
"priority" => 12,
"producer" => ["id" => 4713, "name" => null],
"producer_show" => 0,
"producer_country" => "",
"collection" => ["id" => null, "name" => null],
"collection_show" => 0,
"supplier" => ["id" => null, "name" => null],
"bulk_prices" => [
["moq" => 10, "price" => 5000],
["moq" => 15, "price" => 4500],
],
"price_cost" => "",
"settings_comments" => "e_shop_page_hoteng_com|e_shop_page_hoteng_rating_com|e_shop_page_hoteng_show_rating_com|e_shop_page_hoteng_com_captcha|e_shop_page_hoteng_vis_com|e_shop_page_hoteng_num30",
"password" => "",
"show_tree" => 0,
"show_stock" => 0,
"moq" => 0,
"shipping" => 0,
"shipping_settings" => 0,
"shipping_price" => 0,
"shipping_note" => "",
"shipping_days" => 0,
"shipping_sum" => 0,
"show_period" => 0,
"bought_with" => "",
"bought_with_email" => "",
"new" => 1,
"reduced_price" => 0,
"discount" => "-20%",
"featured" => 1,
"promotion" => 1,
"promotion_text" => "",
"promotion_expires" => 1751113909,
"promotion_expires_job" => 0,
"variations_title" => "",
"variations_type" => 0,
"variations_require" => 0,
"variations_cartexplode" => 0,
"yml" => 0,
"noimport" => "0",
"custom_label_4" => "",
"description_tab_1" => "",
"description_tab_2" => "",
"description_tab_3" => "",
"description_tab_4" => "",
"description_tab_5" => "",
"video" => "",
"video_duration" => "",
"delete" => "delete",
"attributes" => [
[
"name" => "Product type",
"options" => ["Sneakers"]
],
[
"name" => "Producer",
"options" => ["Converse"]
],
[
"name" => "Size",
"options" => ["37,5", "40"]
],
]
];
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "UPDATE");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($productData, JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer " . $authKey,
"Content-Type: application/json"
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo "Request error: " . curl_error($ch);
} else {
$data = json_decode($response, true);
print_r($data);
}
curl_close($ch);