How is a price rendered on a frontend product view page?


See my ready «Price Format» extension for Magento 2.







$priceCode is final_price on a catalog product view.
$type is a product type (e.g. configurable).

$renderClassName may be \Magento\Catalog\Pricing\Render\FinalPriceBox.



$price may be \Magento\ConfigurableProduct\Pricing\Price\FinalPrice.



$priceInfo may be Magento\Framework\Pricing\PriceInfo\Base.
$priceCollection may be \Magento\ConfigurableProduct\Pricing\Price\Collection:


$renderBlock may be \Magento\Catalog\Pricing\Render\FinalPriceBox.


The result may be Magento_Catalog::product/price/final_price.phtml.


$priceModel supports the \Magento\/Framework\Pricing\Price\PriceInterface interface and may be, for example, an instance of the \Magento\ConfigurableProduct\Pricing\Price\ConfigurableRegularPrice class.




$amountBlock could be an instance of the \Magento\Framework\Pricing\Render\Amount class.


The result could be Magento_Catalog::product/price/amount/default.phtml.







A post was split to a new topic: Where is set the value chich is used by the block’s getDisplayLabel() method while rendering a price on a frontend product view page?

A post was split to a new topic: How to render priceHtml on a custom phtml on view page?

See also: