I see price string Current variation price. [read-only]
on this documentation (official api rest doc from WooCommerce).
Does it mean that it's impossible to make an app to update a product variation price ?
I see price string Current variation price. [read-only]
on this documentation (official api rest doc from WooCommerce).
Does it mean that it's impossible to make an app to update a product variation price ?
After some research, i found this example : PUT /wp-json/wc/v3/products/<product_id>/variations/<id>
So in javascript we could do :
const data = {
regular_price: "10.00"
};
WooCommerce.put("products/22/variations/733", data)
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.log(error.response.data);
});
And the JSON API Response :
{
"id": 733,
"date_created": "2017-03-23T00:53:11",
"date_created_gmt": "2017-03-23T03:53:11",
"date_modified": "2017-03-23T00:53:11",
"date_modified_gmt": "2017-03-23T03:53:11",
"description": "",
"permalink": "https://example/product/ship-your-idea/?attribute_pa_color=green",
"sku": "",
"price": "10.00",
"regular_price": "10.00",
"sale_price": "",
...
}
I'll do some test, but i think it's possible to update a product variation price with WooCommerce API/REST.