cancel
Showing results for 
Search instead for 
Did you mean: 

Override FinalPriceBox.php in Pricing folder Magento Catalog

Override FinalPriceBox.php in Pricing folder Magento Catalog

I am trying to override vendor\magento\module-catalog\Pricing\Render\FinaPriceBox.php in my custom module , but its NOT overriding.

di.xml
<preference for="Magento\Catalog\Pricing\Render\FinalPriceBox" type="Vendor\CustomModule\Pricing\Render\FinalPriceBox1" />

Is it possible to override Php classes from the Pricing folder?

 

3 REPLIES 3

Re: Override FinalPriceBox.php in Pricing folder Magento Catalog

Does this help?

 

<type name="Magento\Framework\Pricing\Render">
<plugin name="Your_Module:hide_price" type="Your\Module\Plugin\PriceRender" />
</type>

 

OR...

 

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<referenceBlock name="render.product.prices">
<arguments>
<argument name="recipe" xsi:type="array">
<item name="prices" xsi:type="array">
<item name="final_price" xsi:type="array">
<item name="render_class" xsi:type="string">Magento\Catalog\Pricing\Render\FinalPriceBox</item>
<item name="render_template" xsi:type="string">Your_Module::product/price/final_price.phtml</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</layout>

 

 

Re: Override FinalPriceBox.php in Pricing folder Magento Catalog

Hello,

 

I have same problem on my side with Magento 2.2.6. Do you find a solution?

 

Regards,

Anthony

Re: Override FinalPriceBox.php in Pricing folder Magento Catalog

To precise my problem, I want to override method _toHtml from FInalPriceBox class.

Do you have any idea?

 

Thank you for your help.