Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit 9ec228e

Browse files
authored
Merge pull request #379 from afirlejczyk/bugfix/configurable-final-price-2
WIP: Fixes for calculating lowest price after refactoring. #375.
2 parents fcdb8b0 + eed127c commit 9ec228e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib/taxcalc.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ export function updateProductPrices ({ product, rate, sourcePriceInclTax = false
101101

102102
if (product.final_price) {
103103
if (product.final_price < product.price) { // compare the prices with the product final price if provided; final prices is used in case of active catalog promo rules for example
104-
assignPrice({product, target: 'price', price: product.final_price, deprecatedPriceFieldsSupport})
105-
if (product.final_price < product.special_price) { // for VS - special_price is any price lowered than regular price (`price`); in Magento there is a separate mechanism for setting the `special_prices`
106-
assignPrice({product, target: 'price', price: product.special_price, deprecatedPriceFieldsSupport}) // if the `final_price` is lower than the original `special_price` - it means some catalog rules were applied over it
104+
assignPrice({product, target: 'price', ...finalPriceWithTax, deprecatedPriceFieldsSupport})
105+
if (product.special_price && product.final_price < product.special_price) { // for VS - special_price is any price lowered than regular price (`price`); in Magento there is a separate mechanism for setting the `special_prices`
106+
assignPrice({product, target: 'price', ...specialPriceWithTax, deprecatedPriceFieldsSupport}) // if the `final_price` is lower than the original `special_price` - it means some catalog rules were applied over it
107+
assignPrice({product, target: 'special_price', ...finalPriceWithTax, deprecatedPriceFieldsSupport})
108+
} else {
109+
assignPrice({product, target: 'price', ...finalPriceWithTax, deprecatedPriceFieldsSupport})
107110
}
108-
assignPrice({product, target: 'special_price', price: product.final_price, deprecatedPriceFieldsSupport})
109111
}
110112
}
111113

0 commit comments

Comments
 (0)