@nuskin/ns-product-lib 2.14.1 → 2.14.2
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 +5 -1
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -60,6 +60,9 @@ async function getProduct(id, market, locale, config) {
|
|
60
60
|
const { data } = await graphQlHttpRequest(payload, config);
|
61
61
|
|
62
62
|
if (data && data.data && data.data.productById) {
|
63
|
+
|
64
|
+
//use to get default variant based on requested sku
|
65
|
+
config.sku = id;
|
63
66
|
const product = mapProduct(data.data.productById, market, locale, config);
|
64
67
|
productData.products.push(new Product(product));
|
65
68
|
productData.count = productData.products.length;
|
@@ -132,8 +135,9 @@ function mapProduct(product, market, locale, config) {
|
|
132
135
|
});
|
133
136
|
}
|
134
137
|
|
138
|
+
|
135
139
|
//serves as parent
|
136
|
-
const defaultVariant = variants[0];
|
140
|
+
const defaultVariant = !kitBundleProducts ? product.variants.find(v => v.sku === config.sku) : variants[0];
|
137
141
|
const productImages = mapProductImages(defaultVariant);
|
138
142
|
|
139
143
|
const {
|