HI! i’ve seen a ton of discussion around this topic - but nothing quite the same as the issue we are experiencing.
Click on “add to cart” from any of the collection carousels, or pages.
https://doublewoodsupplements.com/
it does not trigger the cart DRAWER to open or refresh the cart count … it does however work on individual product pages. I can see in the code something trying to execute and not executing I just don’t know what is causing it to fail.
any ideas?!
1 Like
@shevrinr
can you please check your theme customization may be allow this or new code customization
1 Like
what do you mean? is this because of some customization that was made on the prestige theme
// Add to Cart Button
$(‘.ad_to_cart_coll’).click(function(){
var ID = $(this).attr(“data-var_id”);
addItemToCart( ID, 1); // paste your id product number
$(‘.cart_dr’).trigger( “click” );
});
function addItemToCart(variant_id, qty) {
data = {
“id”: variant_id,
“quantity”: qty
}
jQuery.ajax({
type: ‘POST’,
url: ‘/cart/add.js’,
data: data,
dataType: ‘json’,
success: function() {
document.documentElement.dispatchEvent(new CustomEvent(‘cart:refresh’, {
bubbles: true //this code is for prestige theme, is to refresh the cart
}));
}
});
}
is there an error here?
1 Like
@shevrinr
are you check your theme customization theme setting?
the cart setting in theme settings is set to DRAWER, and it does work from the product detail pages, just none of these collection pages or carousels
1 Like
@shevrinr
yes it can be done customization code
it looks like someone already tried to do that with the code i put in an earlier post - i assume this code is not working properly?