Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Display success message after deleting last product in cart

weronka25cad6bd58c4
diff --git a/saleor/static/js/storefront.js b/saleor/static/js/storefront.js
index a91538e1d2..52863c8d2f 100644
--- a/saleor/static/js/storefront.js
+++ b/saleor/static/js/storefront.js
@@ -217,9 +217,12 @@ $cartLine.each(function() {
data: {quantity: newQuantity},
success: (response) => {
if (newQuantity == 0) {
- $(this).fadeOut()
if (response.cart_length == 0) {
+ $.cookie('alert', 'true', { path: '/cart' })
location.reload()
+ } else {
+ $removeProductSucces.removeClass('hidden-xs-up')
+ $(this).fadeOut()
}
} else {
$subtotal.html(response.subtotal)
@@ -247,6 +250,7 @@ $cartLine.each(function() {
$cartDropdown.load(summaryLink)
$removeProductSucces.removeClass('hidden-xs-up')
} else {
+ $.cookie('alert', 'true', { path: '/cart' })
location.reload()
}
}
@@ -254,6 +258,11 @@ $cartLine.each(function() {
})
})
+if ($.cookie('alert') == 'true') {
+ $removeProductSucces.removeClass('hidden-xs-up')
+ $.cookie('alert', 'false', { path: '/cart' })
+}
+
$closeMsg.on('click', (e) => {
$removeProductSucces.addClass('hidden-xs-up')
})