Liquid, JavaScript, themes, sales channels
I am facing an issue with adding multiple products to the cart using jquery ajax. I am getting multiple ids in the console. I tested the network tab as well and it is showing multiple add requests with a perfect status of 200 but when I refresh the page to view the cart it is showing 1 product and sometimes all get into the cart. I don't know why it is failing sometimes.
$('.radio.selected').each(function( index ) {
var The_id = $( this ).attr('datacustom_id');
console.log(The_id);
jQuery.ajax({
url:'/cart/add.js',
type: 'post',
dataType: 'json',
data: { quantity:1, id: The_id }
// Optional: success/error functions
})
});
2 requests with response 200 but some time it adds 2 product in cart and sometime only 1 is added
This has been a pretty constant issue for me as well.
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024