Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#69: Fix for incorrect price rendering for configurable products #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ericclaeren
Copy link

Fixed price value, I would think, it always should be the final price, product type shouldn't matter. Final price incorporates tax/discount/special price and matches the displayed value on the product page.

In the current logic $price is always set, so the logic of simple/configurable is never called.
Thought about removing the getProductPrice method, but this could be an issue for people using this method in custom extensions.

Explanation:

$price = $product
                ->getPriceInfo()
                ->getPrice(FinalPrice::PRICE_CODE)
                ->getAmount()

Returns an AmountInterface object.

->getBaseAmount()

getBaseAmount() fetches the amount without tax calculations, for the the final price amount it seems you should call:

->getValue()

Which is equal to getFinalPrice(), so don't see much value for all the logic and just call ->getFinalPrice() on the product, and let the product decide what the correct route is for fetching the correct amount.

Tested on Magento 2.4.3 and 2.3.5-p1 with 2.7.0.

  • Checked configurable product
  • Checked simple product
  • Checked simple product with discount (catalog rule)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant