Updating Woocommerce Variation Products Prices Via Zoho CRM

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.

  1. void updateVariableProductInWoocommerce(string product_id, string variation_id, string regular_price, string sale_price, string stock_quantity)
  2. {
  3. url = "<Your Base URL>/wp-json/wc/v3/products/" + product_id + "/variations/" + variation_id;
  4. params = Map();
  5. params.put("regular_price",regular_price);
  6. params.put("sale_price",sale_price);
  7. params.put("stock_quantity",stock_quantity);
  8. response = invokeurl
  9. [
  10. url :url
  11. type :PUT
  12. parameters:params.toString()
  13. connection:"<Connection Link Name of Woocommerce>"
  14. content-type:"application/json"
  15. ];
  16. info response;
  17. }