Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove product from cart if quantity set to 0
weronkafe6229e08228
diff --git a/saleor/static/js/storefront.js b/saleor/static/js/storefront.jsindex 093b31a657..a91538e1d2 100644--- a/saleor/static/js/storefront.js+++ b/saleor/static/js/storefront.js@@ -171,15 +171,15 @@ $countrySelect.on('change', (e) => {// Save tab links to URL$('.nav-tabs a').click((e) => {- e.preventDefault();- $(this).tab('show');+ e.preventDefault()+ $(this).tab('show')});$("ul.nav-tabs li a:not(:first)").on("shown.bs.tab", (e) => {- var id = $(e.target).attr("href").substr(1);- window.location.hash = id;+ var id = $(e.target).attr("href").substr(1)+ window.location.hash = id});var hash = window.location.hash;-$('.nav-tabs a[href="' + hash + '"]').tab('show');+$('.nav-tabs a[href="' + hash + '"]').tab('show')// Variant Picker@@ -216,7 +216,14 @@ $cartLine.each(function() {method: 'POST',data: {quantity: newQuantity},success: (response) => {- $subtotal.html(response.subtotal)+ if (newQuantity == 0) {+ $(this).fadeOut()+ if (response.cart_length == 0) {+ location.reload()+ }+ } else {+ $subtotal.html(response.subtotal)+ }$total.html(response.total)$cartBadge.html(response.cart)$qunatityError.html('')diff --git a/saleor/static/scss/storefront/components/_checkout.scss b/saleor/static/scss/storefront/components/_checkout.scssindex 5af6f97962..a18df2997f 100644--- a/saleor/static/scss/storefront/components/_checkout.scss+++ b/saleor/static/scss/storefront/components/_checkout.scss@@ -63,7 +63,7 @@}&__payment-method-form, form {label {- margin-bottom: $global-margin;+ margin-bottom: $global-margin / 2;input {display: inline-block;vertical-align: top;