Skip to content
Advertisement

Remove specific product variation from cart in WooCommerce

I want to remove a variation product from the cart in wordpress, woocommerce.

I’m able to remove a simple product but not a variation product. With this code I can remove a simple product. I have tried passing in both the variation id and the parent variation id. I have no idea why its not working, would appreciate if some got a clue.

JavaScript

Advertisement

Answer

You can also use a foreach loop as follow to target and remove a specific variation id from cart:

JavaScript

Tested and works.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement