diff --git a/static/components/customer-stall/customer-stall.js b/static/components/customer-stall/customer-stall.js index 34aef83..a9bac78 100644 --- a/static/components/customer-stall/customer-stall.js +++ b/static/components/customer-stall/customer-stall.js @@ -124,10 +124,10 @@ async function customerStall(path) { this.cart.products = prod this.updateCart(+item.price) }, - removeFromCart(item) { + removeFromCart(item, del = false) { let prod = this.cart.products let qty = prod.get(item.id).quantity - if (qty == 1) { + if (qty == 1 || del) { prod.delete(item.id) } else { prod.set(item.id, { diff --git a/static/components/shopping-cart/shopping-cart.js b/static/components/shopping-cart/shopping-cart.js index 2961fa3..15df126 100644 --- a/static/components/shopping-cart/shopping-cart.js +++ b/static/components/shopping-cart/shopping-cart.js @@ -29,6 +29,13 @@ async function shoppingCart(path) { 'remove-from-cart', this.products.find(p => p.id == id) ) + }, + removeProduct(id) { + this.$emit( + 'remove-from-cart', + this.products.find(p => p.id == id), + true + ) } }, created() {}