Liam Diviney
05/22/2025, 12:54 PMTightknit
05/22/2025, 12:54 PMTightknit
05/22/2025, 12:54 PMCarissa Cui
05/22/2025, 9:01 PM<script>
document.addEventListener('DOMContentLoaded', function() {
var cartButton = document.querySelector('.cart-button');
var cartDrawer = document.querySelector('.cart-drawer');
if (cartButton && cartDrawer) {
cartButton.addEventListener('click', function() {
cartDrawer.classList.toggle('open');
});
}
});
</script>
Try this one out and let me know if it works! There hasn't been any official documentation around slide out carts for Horizon yet, so will have to test around until something hits šLiam Diviney
05/23/2025, 11:11 AMCarissa Cui
05/27/2025, 6:23 PMfetch('/cart.js')
.then(response => response.json())
.then(cart => {
fetch('/?snippets_id=cart-drawer')
.then(response => response.text())
.then(text => {
const sectionInnerHTML = new DOMParser().parseFromString(text, 'text/html');
const cartFormInnerHTML = sectionInnerHTML.querySelector('cart-items-component').innerHTML;
document.querySelector('cart-items-component').innerHTML = cartFormInnerHTML;
document.querySelector('cart-drawer-component > button').click();
document.querySelector('.cart-bubble__text-count').innerHTML = cart.item_count;
document.querySelector('cart-icon').classList.add('header-actions__cart-icon--has-cart');
document.querySelector('.cart-bubble').classList.remove('visually-hidden');
});
});Liam Diviney
05/27/2025, 8:17 PM