File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
packages/storefront/src/lib/composables Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
103103 isFetching . value = false ;
104104 } ) ( ) ;
105105 }
106+
106107 if ( shouldRefetchStock ) {
107108 idsToStockRefetch . push ( product . _id ) ;
108109 refetchStock ( ) ;
@@ -188,6 +189,7 @@ const useProductCard = <T extends ProductItem | undefined = undefined>(props: Pr
188189 product . quantity = maxKitQnt ;
189190 }
190191 } ;
192+
191193 const isLoadingToCart = ref ( false ) ;
192194 const isFailedToCart = ref ( false ) ;
193195 const loadToCart = async (
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export const useProductDetails = (props: Props) => {
2929 const quantity = ref ( product . min_quantity || 1 ) ;
3030 const hasSkuSelectionAlert = ref ( false ) ;
3131 const variationId = ref < ResourceId | null > ( props . variationId || null ) ;
32+
3233 watch ( toRef ( props . variationId ) , ( ) => {
3334 if ( props . variationId === undefined ) return ;
3435 variationId . value = props . variationId ;
@@ -49,6 +50,7 @@ export const useProductDetails = (props: Props) => {
4950 } , { immediate : true } ) ;
5051 } ) ;
5152 }
53+
5254 const isSkuSelected = computed ( ( ) => {
5355 return Boolean ( ! product . variations ?. length || variationId . value ) ;
5456 } ) ;
@@ -61,10 +63,12 @@ export const useProductDetails = (props: Props) => {
6163 }
6264 return ! hasSkuSelectionAlert . value ;
6365 } ;
66+
6467 const addToCart = ( ) => {
6568 if ( ! checkVariation ( ) ) return ;
6669 loadToCart ( quantity . value , { variationId : variationId . value } ) ;
6770 } ;
71+
6872 const shippedItems = reactive ( [ {
6973 ...product ,
7074 body_html : undefined ,
@@ -73,6 +77,7 @@ export const useProductDetails = (props: Props) => {
7377 watch ( quantity , ( ) => {
7478 shippedItems [ 0 ] . quantity = quantity . value ;
7579 } ) ;
80+
7681 return {
7782 product,
7883 variationId,
You can’t perform that action at this time.
0 commit comments