In a recent project I was working on, I had the need to remove multiple products from the basket at once. At first glance I thought this would be trivial, but quickly found it to be rather problematic.
Ultimately the method that worked out best for me was to construct the following request via a jQuery.post() call.
jQuery.post('/cart/update.js', {updates: {794864053: 0, 794864233: 0}});
The number is the variant ID for the product in the cart that you want to remove. The reason this method is the best is that every other method I found only allowed for the removal of one item at a time from the basket.
I would have to do some testing, but it could be possible to create a form that generates this request so it can be submitted via straight HTML.
Leave a Reply
You must be logged in to post a comment.