@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.13.0-cx24-51071125.1",
3
+ "version": "2.13.0-cx24-5107.18",
4
4
  "description": "This project contains shared Product models and code between the backend and frontend.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -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,