Skip to content

Commit 1d285db

Browse files
committed
fix product set add to cart issue
1 parent fbff22a commit 1d285db

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

packages/extension-chakra-storefront/src/pages/product-detail/partials/product-details-composite.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,12 @@ const CompositeProductDetails = ({
6464
<Box key={childProduct.id} data-testid="child-product">
6565
<ProductView
6666
// Do not use an arrow function as we are manipulating the functions scope.
67-
ref={function (productViewRef) {
68-
// The ref callback will be called with `null` when the component unmounts.
69-
// We need to guard against that to prevent a runtime error.
70-
if (productViewRef) {
71-
// Assign the "set" scope of the ref, this is how we access the internal
72-
// validation.
73-
childProductRefs.current[childProduct.id] = {
74-
ref: productViewRef,
75-
validateOrderability:
76-
productViewRef.validateOrderability
77-
}
67+
ref={function (ref) {
68+
// Assign the "set" scope of the ref, this is how we access the internal
69+
// validation.
70+
childProductRefs.current[childProduct.id] = {
71+
ref,
72+
validateOrderability: this.validateOrderability
7873
}
7974
}}
8075
product={childProduct}
@@ -94,7 +89,9 @@ const CompositeProductDetails = ({
9489
])
9590
: null
9691
}
97-
addToWishlist={isProductASet ? handleAddToWishlist : null}
92+
addToWishlist={
93+
isProductASet ? handleAddToWishlist : null
94+
}
9895
onVariantSelected={(product, variant, quantity) => {
9996
if (quantity) {
10097
setChildProductSelection((previousState) => ({
@@ -116,7 +113,9 @@ const CompositeProductDetails = ({
116113
isProductLoading={isProductLoading}
117114
isBasketLoading={isBasketLoading}
118115
isWishlistLoading={isWishlistLoading}
119-
setChildProductOrderability={setChildProductOrderability}
116+
setChildProductOrderability={
117+
setChildProductOrderability
118+
}
120119
/>
121120
<InformationAccordion product={childProduct} />
122121

0 commit comments

Comments
 (0)