Skip to content
Choosing a selection results in a full page refresh.
openCartDrawer(cart) {
setTimeout(function () {
var $body = $('body'),
$doc = $(document),
$html = $('html'),
$win = $(window);
const $cartDropdown = $('#halo-cart-sidebar .halo-sidebar-wrapper .previewCart-wrapper');
const $cartLoading = '';
const loadingClass = 'is-loading';
$cartDropdown
.addClass(loadingClass)
.prepend($cartLoading);
$.ajax({
type: 'GET',
url: window.routes.root + '/cart?view=ajax_side_cart',
cache: false,
success: function (data) {
var response = $(data);
$cartDropdown
.removeClass(loadingClass)
.html(response);
},
error: function (xhr, text) {
// halo.showWarning($.parseJSON(xhr.responseText).description);
},
complete: function () {
document.dispatchEvent(new CustomEvent('cart-update', { detail: cart }));
if ($('body').hasClass('cursor-fixed__show')){
window.sharedFunctionsAnimation.onEnterButton();
window.sharedFunctionsAnimation.onLeaveButton();
}
}
});
const $cartIcon = document.querySelector('.header__icon.header__icon--cart');
if ($cartIcon) $cartIcon.click();
$.getJSON("/cart.js").then(function (cart) {
var count = 0;
for (var i = 0; i < cart.items.length; i++) {
count += cart.items[i].quantity;
}
$(".header__icon--cart .cart-count-bubble [data-cart-count], .wrapper-cartCount .cartCount").text(count);
});
}, 800);
}