Updating product variations in WooCommerce

Hi all,

We have 2 systems; system A (WooCommerce) and system B (erp-system). We’d like to send the modified stock levels (free_qty) of system B to system A, by use of their woocommerce_product_id and woocommerce_variant_id. Can we send this information in bulk to WooCommerce?

{
  "__last_update": "2023-12-18 16:51:29",
  "default_code": "variant_1",
  "free_qty": 8,
  "id": 13656,
  "lst_price": 144.59,
  "name": "Product A",
  "weight": 6.54,
  "woocommerce_product_id": "13678",
  "woocommerce_variant_id": "16852"
},
{
  "__last_update": "2023-12-18 16:51:29",
  "default_code": "variant_2",
  "free_qty": 10,
  "id": 13657,
  "lst_price": 247.89,
  "name": "Product B",
  "weight": 10.93,
  "woocommerce_product_id": "13680",
  "woocommerce_variant_id": "16856"
}

WooCommerce is using PUT /wp-json/wc/v3/products/<product_id>/variations/ as http request for updating product variations.

Hi @wouter
I can see a “batch” API endpoint.
https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-product-variations
“POST /wp-json/wc/v3/products/<product_id>/variations/batch”

Is this what you were looking for?

1 Like

Hi @Catalin,

I have overlooked this option in the API. This should indeed work for us. Thanks!