I want to remove cart products if cart contains more than 20 products then it should be removed latest more than 20 products for example if I add 21 products then last 1 product will be removed from cart if there any way to achieve this type of functionality
jQuery.getJSON('/cart.js', function (data) {
var count_new = data.items.id;
console.log(count_new);
});
I have tried this code but its not working