'; $('#promotion__code-input-wrapper').append(promotion_code_html); } } $('.cart-count').text(data.item_count); $('#CartDrawer .cart__row-wrapper').append(cart__html); $('#CartDrawer #hasCartItem').removeClass('is-loading'); if(data.errors != undefined && data.errors.length > 0){ $("#CartDrawer .cart-drawer-content").animate({ scrollTop: 0 }); } } theme.fetchCartDrawer = function(data){ $('#CartDrawer #hasCartItem').addClass('is-loading'); $.ajax({ url: '/cart?retrieve=true', type: 'get', success: function(data, status) { // console.log(data); theme.cartDrawer(data); $('#CartDrawer #hasCartItem').removeClass('is-loading'); }, error: function(XMLHttpRequest, textStatus) { location.reload(); } }); } theme.updateCartDrawer = function(data){ $('#CartDrawer #hasCartItem').addClass('is-loading'); $.ajax({ url: '/cart?retrieve=true', type: 'post', dataType: 'json', data: $('#CartDrawer form').serialize(), success: function(data, status) { // console.log(data); if(data.status == 'error'){ $('#cartDrawerError').empty(); var errorMsg = '