Skip to content
This repository was archived by the owner on Aug 30, 2018. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions assets/ajax-cart.js.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ var ajaxCart = (function(module, $) {

// Add or remove from the quantity
$body.on('click', '.ajaxcart__qty-adjust', function() {
if (isUpdating) {
return;
}

var $el = $(this),
line = $el.data('line'),
$qtySelector = $el.siblings('.ajaxcart__qty-num'),
Expand All @@ -359,6 +363,10 @@ var ajaxCart = (function(module, $) {

// Update quantity based on input on change
$body.on('change', '.ajaxcart__qty-num', function() {
if (isUpdating) {
return;
}

var $el = $(this),
line = $el.data('line'),
qty = parseInt($el.val().replace(/\D/g, ''));
Expand Down Expand Up @@ -412,13 +420,12 @@ var ajaxCart = (function(module, $) {
};

adjustCartCallback = function (cart) {
isUpdating = false;

// Update quantity and price
updateCountPrice(cart);

// Reprint cart on short timeout so you don't see the content being removed
setTimeout(function() {
isUpdating = false;
ShopifyAPI.getCart(buildCart);
}, 150)
};
Expand Down