How can i hide the price of products for a particular customer group? I want to hide the price everywhere for this customer including checkout,cart pages.


1 Answer 1


I had done it with plugin on same requirements,

Hide price box for specific customer group condition.

=> app/code/{{vendor}}/{{module}}/etc/di.xml

<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="{{vendor}}\{{module}}\Plugin\HidePriceBox" sortOrder="1" disabled="false"/>


namespace {{vendor}}\{{module}}\Plugin;
class HidePriceBox
    protected $_customerSession;
    protected $_customerGroupCollection;

    public function __construct(        
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Customer\Model\Group $customerGroupCollection
    ) {
        $this->_customerSession = $customerSession;    
        $this->_customerGroupCollection = $customerGroupCollection;

    public function getCustomerGroup()
        $currentGroupId = $this->_customerSession->getCustomer()->getGroupId();
        $collection = $this->_customerGroupCollection->load($currentGroupId); 
        $customer_group = $collection->getCustomerGroupCode();
        return $customer_group;

    function afterToHtml(\Magento\Catalog\Pricing\Render\FinalPriceBox $subject, $result)
        $customerGroup = $this->getCustomerGroup();
        if($customerGroup == 'hide_customer_group')   //replace with customer group
            return '';
        return $result;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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