Skip to content

Commit 33aa293

Browse files
committed
Add price calculation improvement for product option value price
The price calculation relied on the getFinalPrice value, which if called without the qty parameter will not consider tier prices. This method was not updated when the price improvements have been added around 4 years ago. See similar update that was added for Magento\Catalog\Model\Product\Option. Resolves: #5774
1 parent f1e6d1c commit 33aa293

File tree

1 file changed

+2
-1
lines changed
  • app/code/Magento/Catalog/Model/Product/Option

1 file changed

+2
-1
lines changed

app/code/Magento/Catalog/Model/Product/Option/Value.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Model\Product;
1212
use Magento\Catalog\Model\Product\Option;
1313
use Magento\Framework\Model\AbstractModel;
14+
use Magento\Catalog\Pricing\Price\BasePrice;
1415

1516
/**
1617
* Catalog product option select type model
@@ -223,7 +224,7 @@ public function saveValues()
223224
public function getPrice($flag = false)
224225
{
225226
if ($flag && $this->getPriceType() == self::TYPE_PERCENT) {
226-
$basePrice = $this->getOption()->getProduct()->getFinalPrice();
227+
$basePrice = $this->getOption()->getProduct()->getPriceInfo()->getPrice(BasePrice::PRICE_CODE)->getValue();
227228
$price = $basePrice * ($this->_getData(self::KEY_PRICE) / 100);
228229
return $price;
229230
}

0 commit comments

Comments
 (0)