Skip to content

Commit

Permalink
Merge pull request #1296 from w3bdesign/dev
Browse files Browse the repository at this point in the history
Update useCart.js
  • Loading branch information
w3bdesign committed Mar 17, 2024
2 parents c5df63f + 3edaee9 commit a7c30cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions store/useCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ export const useCart = defineStore("cartState", {
const response = await mutate({
input: {
productId: product.databaseId,
quantity: 1, // Assuming you're adding one product at a time
quantity: 1,
},
});

if (response.data && response.data.addToCart) {
this.loading = false;
// Assuming the response returns the updated cart item, we need to handle it properly
const newCartItem = response.data.addToCart.cartItem;
const foundProductInCartIndex = this.cart.findIndex(
(cartProduct) => newCartItem.product.node.slug === cartProduct.slug
Expand Down

0 comments on commit a7c30cb

Please sign in to comment.