Magento – Magento 2 – duplicate pricing block to show in 2 places on the product page

configurable-productmagento2product-attribute

I'm new to Magento 2 and would like to see if anybody could help me.

I need to show the product price in two different places on the product page. If a configurable product the price should render when an option is chosen to show the updated price based on the user's choice.

I have tried to duplicate the pricing block in catalog_product_view.xml

<block class="Magento\Catalog\Pricing\Render" name="custom.product.price.final" after="product.info.sku">
    <arguments>
          <argument name="price_render" xsi:type="string">product.price.render.default</argument>
          <argument name="price_type_code" xsi:type="string">final_price</argument>
          <argument name="zone" xsi:type="string">item_view</argument>
    </arguments>
</block>

This did not work does anybody know a way to do this?

Thanks

Best Answer

use below code and paste it in catalog_product_view.xml between <referenceContainer name="content"></referenceContainer>

<block class="Magento\Catalog\Pricing\Render" name="product.price.final_2" after="product.info.main">
                    <arguments>
                        <argument name="price_render" xsi:type="string">product.price.render.default</argument>
                        <argument name="price_type_code" xsi:type="string">final_price</argument>
                        <argument name="zone" xsi:type="string">item_view</argument>
                    </arguments>
                </block>
Related Topic