Hi,
I realized on the site: https://helssyhair.com/
Preview for help me : https://lrep2n8d956oynuj-50154504344.shopifypreview.com
An add to basket button on the collections the button works correctly and the menu is displayed laterally on android on the other hand on Ios when I click on add to basket the addition to the basket is carried out but there is a redirection to the basket page
document.querySelectorAll("button.ad_to_cart_coll").forEach((item,index)=>{
item.addEventListener('click',function(e){
console.log(this,1);
e = e || window.event;
e.preventDefault();
let id = this.getAttribute('data-var_id');
let formData = {
'items': [
{
'id': id,
'quantity': 1
}
]
};
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then((resp) => {
return resp.json();
})
.then((data) => {
document.documentElement.dispatchEvent(new CustomEvent('cart:refresh', {
bubbles: true
}));
document.querySelector("a#panier_icon_ajax").dispatchEvent(new Event('click', { 'bubbles': false }));
})
.catch((err) => {
console.error('Error: ' + err);
})
});
});
It comes from this line
document.querySelector("a#panier_icon_ajax").dispatchEvent(new Event('click', { 'bubbles': false }));
What can I use to make the side cart also show on Ios(iphone) without the redirect?
Merci