Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

fix(useCart): canAddToCart not working correctly #3

Merged
merged 2 commits into from
Mar 6, 2023
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
4 changes: 2 additions & 2 deletions modules/checkout/composables/useCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { removeCouponCommand } from '~/modules/checkout/composables/useCart/comm
import { removeItemCommand } from '~/modules/checkout/composables/useCart/commands/removeItemCommand';
import { updateItemQtyCommand } from '~/modules/checkout/composables/useCart/commands/updateItemQtyCommand';
import { Logger } from '~/helpers/logger';
import { Cart, CartItemInterface, ProductInterface } from '~/modules/GraphQL/types';
import { Cart, CartItemInterface, ProductInterface, ProductStockStatus } from '~/modules/GraphQL/types';
import { useCartStore } from '~/modules/checkout/stores/cart';
import { useWishlist } from '~/modules/wishlist/composables/useWishlist';
import { Product } from '~/modules/catalog/product/types';
Expand Down Expand Up @@ -272,7 +272,7 @@ PRODUCT
return !!product?.configurable_product_options_selection?.variant
?.uid;
}
const inStock = product?.stock_status || '';
const inStock = product?.stock_status === ProductStockStatus.InStock ? true : false;
const stockLeft = product?.only_x_left_in_stock === null
? true
: qty <= product?.only_x_left_in_stock;
Expand Down