File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
app/code/Magento/Catalog/Pricing/Price Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ class MinimalTierPriceCalculator implements MinimalPriceCalculatorInterface
2020 */
2121 private $ calculator ;
2222
23-
2423 /**
2524 * @param CalculatorInterface $calculator
2625 */
@@ -48,22 +47,16 @@ public function getValue(SaleableInterface $saleableItem)
4847 */
4948 public function getAmount (SaleableInterface $ saleableItem )
5049 {
51- $ lowestTierPrice = null ;
50+ $ minPrice = null ;
5251 /** @var TierPrice $price */
5352 $ tierPrice = $ saleableItem ->getPriceInfo ()->getPrice (TierPrice::PRICE_CODE );
5453 $ tierPriceList = $ tierPrice ->getTierPriceList ();
55- $ finalPrice = $ saleableItem ->getPriceInfo ()->getPrice (FinalPrice::PRICE_CODE )->getValue ();
5654
57- $ minPrice = $ finalPrice ;
58- foreach ($ tierPriceList as $ tierPrice ) {
59- /** @var AmountInterface $price */
60- $ price = $ tierPrice ['price ' ];
61- if ($ minPrice > $ price ->getValue ()) {
62- $ minPrice = $ price ->getValue ();
63- $ lowestTierPrice = $ price ;
64- }
55+ if (count ($ tierPriceList )) {
56+ usort ($ tierPriceList , fn ($ tier1 , $ tier2 ) => $ tier1 ['price ' ]->getValue () <=> $ tier2 ['price ' ]->getValue ());
57+ $ minPrice = array_shift ($ tierPriceList )['price ' ];
6558 }
6659
67- return $ lowestTierPrice ;
60+ return $ minPrice ;
6861 }
6962}
You can’t perform that action at this time.
0 commit comments