Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025