Updating Woocommerce Variation Products Prices Via Zoho CRM
I can update product prices with this flow:
But I can't update variant products. I got a code from Zoho for this, but I couldn't get it to work. It needs to find the product in the CRM from the SKU field and update the variation with the price there.
- void updateVariableProductInWoocommerce(string product_id, string variation_id, string regular_price, string sale_price, string stock_quantity)
- {
- url = "<Your Base URL>/wp-json/wc/v3/products/" + product_id + "/variations/" + variation_id;
- params = Map();
- params.put("regular_price",regular_price);
- params.put("sale_price",sale_price);
- params.put("stock_quantity",stock_quantity);
- response = invokeurl
- [
- url :url
- type :PUT
- parameters:params.toString()
- connection:"<Connection Link Name of Woocommerce>"
- content-type:"application/json"
- ];
- info response;
- }