I have 2 customizations of the FinalPriceBox
block, one I would like to be the default for the site, the other only on the product view page. I've added a layout update view/frontend/layout/catalog_product_prices.xml to my custom module; in there I specify a custom block FinalPriceBoxGeneral
and template final_price_general.phtml
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<block class="Magento\Framework\Pricing\Render\RendererPool" name="render.product.prices">
<arguments>
<argument name="default" xsi:type="array">
<item name="prices" xsi:type="array">
<item name="final_price" xsi:type="array">
<item name="render_class" xsi:type="string">Moxune\Amazing\Block\Catalog\Pricing\Render\FinalPriceBoxGeneral</item>
<item name="render_template" xsi:type="string">Moxune_Amazing::product/price/final_price_general.phtml</item>
This works to change the block & template everywhere on the site.
I've now tried to get change the block and template on just the product view page by adding to view/frontend/layout/catalog_product_view.xml in my plugin
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="render.product.prices">
<arguments>
<argument name="default" xsi:type="array">
<item name="prices" xsi:type="array">
<item name="render_class" xsi:type="string">Moxune\Amazing\Block\Catalog\Pricing\Render\FinalPriceBoxDetail</item>
<item name="render_template" xsi:type="string">Moxune_Amazing::product/price/final_price_detail.phtml</item>
However this seems to have no effect on the product view page.