@nuskin/ns-product-lib 2.13.0-cx24-51071125.1 → 2.13.0-cx24-5107.18
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/graph-ql/product.js +10 -1
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -299,13 +299,22 @@ function mapChildSKU(kitBundleProducts, productSku) {
|
|
299
299
|
}
|
300
300
|
return kitBundleProducts.kitProducts.map((kitProduct) => {
|
301
301
|
const { product } = kitProduct;
|
302
|
+
let defaultVariant;
|
302
303
|
if (personalOffer && personalOffer.active) {
|
303
304
|
const variantSelected = kitProduct.product.variants.filter(v =>
|
304
305
|
v.sku === productWithVariant[0].variantSelected[kitProduct.product.id]
|
305
306
|
)
|
306
307
|
console.log(variantSelected)
|
308
|
+
if (variantSelected[0].sku !== "") {
|
309
|
+
defaultVariant = variantSelected[0]
|
310
|
+
} else {
|
311
|
+
defaultVariant = product.variants[0];
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
if (!defaultVariant) {
|
316
|
+
defaultVariant = product.variants[0];
|
307
317
|
}
|
308
|
-
const defaultVariant = product.variants[0];
|
309
318
|
return {
|
310
319
|
productId: product.id,
|
311
320
|
skuId: defaultVariant.sku,
|