I have created events observer which is working fine to check whether the customer is logged in or not. If the customer is not logged in then the price will not be displayed.
Here's my code:
custom_log_out.xml
in
app/code/Demo/Mymodule/view/frontend/layout:
<?xml version="1.0"?>
<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="default" xsi:type="array">
<item name="prices" xsi:type="array">
<item name="final_price" xsi:type="array">
<item name="render_template" xsi:type="string">Demo_Mymodule::product/price/final_price.phtml</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</layout>
Then created final_price.phtml
in
app/code/Demo/Mymodule/view/frontend/templates/product/price
which have my custom code:
<p>Login to Continue</p>
But it's not working can please anyone guide me?