I am trying to figure out how to adjust multiple cart items.
Essentially, we have a custom order page which adds multiple products to the cart. All of the products added have the same unique property.
For example, these two products are added to the cart:
Product 1
ID: 1000
Property: CustomProduct2
Product2
ID: 1001
Property: CustomProduct2
The end-user just sees this as one product so I would like a way to remove or adjust the quantities for all products with matching properties with one button.
I know the below wont work but presume if possible, it would be something along the lines of:
$(document).on('click','.remove',function(e){
var property = $(this).attr('data-property');
$.ajax({
type: 'POST',
url: '/cart/add.js',
data: {
quantity: 0,
id: *,
properties: {
'Property': data-property
}
},
dataType: 'json',
async:false,
});
});