1

I need to show the MSRP price next to the regular price on the product view page in a Magento 2 site.

So it would be like:

$199 (MSRP: $399)

I have found this question: How to display MSRP / RRP on product page

The problem is I am lacking some pre-requisite knowledge to follow these instructions.

The theme I am using doesn't have a price.phtml so I guess I need to override it from a module. I searched the vendor directory and found several price.phtml files which is confusing to me. Which one do I override?

The theme I am using (Ultimo) has a custom catalog_product_view.xml file which has this xml which I think refers to the part I want to edit:

<container name="product.info.price" label="Product info auxiliary container" htmlTag="div" htmlClass="product-info-price" after="product.info.review">
    <container name="product.info.stock.sku" label="Product auxiliary info" htmlTag="div" htmlClass="product-info-stock-sku">
        <container name="product.info.type" before="-"/>
        <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.info.type">
            <arguments>
                <argument name="at_call" xsi:type="string">getSku</argument>
                <argument name="at_code" xsi:type="string">sku</argument>
                <argument name="css_class" xsi:type="string">sku</argument>
                <argument name="at_label" xsi:type="string">default</argument>
                <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument>
            </arguments>
        </block>
    </container>
    <block class="Magento\Catalog\Block\Product\View" name="product.info.review" template="product/view/review.phtml" after="product.info.stock.sku" />
    <block class="Magento\Catalog\Pricing\Render" name="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>
</container>

So do I need to add something in to this xml for it to render the MSRP or do I need to edit something that it's already showing? I can't see which template is responsible for outputting price so does that mean the default magento 2 one is being used?

I am really struggling here to get a firm grip on how the system works and edit it in correct manner. Thanks for your help.

  • Im trying to do exactly the same, also with Ultimo. Did you manage to get this to work – Darren Sutherland Dec 5 '17 at 6:57
  • MSRP price can be shown in PDP by default in magento 2..Enable the MAP price and provide the msrp price from the Advanced pricing. For ref:mageplaza.com/kb/… – Haritha Nov 18 '18 at 9:16
0

To show msrp price you can add a following code to catalog_product_view.xml

<referenceContainer name="product.info.main">
        <referenceContainer name="product.info.price">
            <block class="Magento\Catalog\Pricing\Render" name="product.price.msrp" before="product.price.final">
                <arguments>
                    <argument name="price_render" xsi:type="string">product.price.render.default</argument>
                    <argument name="price_type_code" xsi:type="string">msrp_price</argument>
                    <argument name="zone" xsi:type="string">item_view</argument>
                </arguments>
            </block>
        </referenceContainer>
    </referenceContainer>

Template responsible for display msrp price

module-msrp/view/base/templates/product/price/msrp.phtml

-1

Please enable template path hints to check which price.phtml file is rendering the price. If it is displayed from core theme please override that and do the changes to display MSRP.

  • vendor/magento/module-msrp/view/base/templates/product/price/msrp.phtml template deals with price display when MSRP is enabled. Real price is in the $data object - $data['addToCart']['realPrice'] – Gediminas Sep 12 '17 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.