If you want to hide the whole website’s product price and want to make it appear only for login users then this article is a catch for you.
1. Create file di.xml on app/code/Magemonkeys/Hideproductprice/etc
1 2 3 4 5 6 7 |
<?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Pricing\Render\FinalPriceBox"> <plugin name="price_hide" type="Magemonkeys\Hideproductprice\Plugin\HidePriceBox" sortOrder="1" disabled="false"/> </type> </config> |
2. Create file HidePriceBox.php on app/code/Magemonkeys/Hideproductprice/Plugin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<?php namespace Magemonkeys\Hideproductprice\Plugin; class HidePriceBox { protected $_customerSession; public function __construct( \Magento\Customer\Model\Session $customerSession ) { $this->_customerSession = $customerSession; } function afterToHtml(\Magento\Catalog\Pricing\Render\FinalPriceBox $subject, $result) { if($this->_customerSession->getCustomer()->getGroupId()) { return $result; }else{ return '<h3>PLEASE DO LOGIN AND SHOW THE PRICE</h3>'; } } } |
3. Result
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-62877074dfc8c671895150/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...