@lancom/shared 0.0.444 → 0.0.446
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
},
|
|
111
111
|
computed: {
|
|
112
112
|
...mapGetters(['shop', 'country', 'currency', 'SETTINGS']),
|
|
113
|
-
...mapGetters('product', ['product', 'usedSimpleProducts', 'template']),
|
|
113
|
+
...mapGetters('product', ['product', 'usedSimpleProducts', 'template', 'defaultSimpleProduct']),
|
|
114
114
|
hasSelection() {
|
|
115
115
|
return (this.usedSimpleProducts || []).length > 0 || this.value;
|
|
116
116
|
},
|
|
@@ -174,10 +174,11 @@ export default {
|
|
|
174
174
|
if (this.value?.size) {
|
|
175
175
|
usedSimpleProducts = usedSimpleProducts.filter(c => c.size._id === this.value?.size?._id);
|
|
176
176
|
}
|
|
177
|
-
const simpleProduct = usedSimpleProducts[0] || this.usedSimpleProducts[0];
|
|
178
|
-
|
|
177
|
+
const simpleProduct = usedSimpleProducts[0] || this.usedSimpleProducts[0] || this.defaultSimpleProduct;
|
|
178
|
+
const amount = this.value?.quantity || simpleProduct.amount || 1;
|
|
179
|
+
usedSimpleProducts = simpleProduct ? [{ ...simpleProduct, amount }] : [];
|
|
179
180
|
}
|
|
180
|
-
const entities = getProductsForCalculatePricing(this.product,
|
|
181
|
+
const entities = getProductsForCalculatePricing(this.product, usedSimpleProducts);
|
|
181
182
|
const payload = {
|
|
182
183
|
entities: entities.map(e => ({ ...e, brand: this.product.brand })),
|
|
183
184
|
postcode: this.suburb?.postcode,
|