0

I want to delete all variations using REST API without passing variation ID. I didn't see any instructions in wooCommerce REST API doc.

1

1 Answer 1

0

I solved it by using an alternative method. The two requests created in this method. First, to call the product than pass the response variation ID's to another batch request, It will delete all the variations but still there is a limit of maximum 100 variation ID's. It won't delete more than 100 variations in a single request.

If anyone knows the better method, please share.

WooCommerce.get("products/794")
  .then((response) => {

WooCommerce.post("products/"+response.data.id+"/variations/batch", response.data.variations)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });


  })
  .catch((error) => {
    console.log(error.response.data);
  });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.