0

I have 2 catalog and i have two group customer: how to proceed to hide price and add to cart for each product in catalog 2 when a customer belong to group1 is log in and same for the customer that belong to group 2 he can't see the price none add to cart of products that belong to catalog 1

1

To accomplish this you could use this https://marketplace.magento.com/estdevs-hideprice.html and modify it to include specific groups i think this is going to be the best and quickest solutions for you and should not take that long to impliment

You could implement something like this to achieve what you are after for the cart button and similar method for price

/app/design/frontend/Your/Theme/Magento_Catalog/templates/product/view/addtocart.phtml

<?php
$objectManager   = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->create( '\Magento\Customer\Model\Session' ); ?>

<?php if ( $customerSession->isLoggedIn() ): ?>
    <?php if($customerSession->getCustomer()->getGroupId() != "1") { ?>
        <div class="box-tocart">
             // The rest of the content from the template
        </div>
    <?php } ?>
<?php endif; ?>
  • thanks for ypur replay but that's not what i want because my pb is how to hide price and add to cart for export products when a customer belong to local group and he can see the add to cart and price for the products that belong to local category – Developper Magento Dec 5 '18 at 11:01
  • if you read my recommendation regard this i said if you use this module you can simply impliment the group functionality to include this and as for the add to cart functionality similar process which can be acheived in the template – Dava Gordon Dec 6 '18 at 11:42
  • i am sorry i was on my way when i opened your replay can you please give me more detail and thanks in advance – Developper Magento Dec 6 '18 at 13:34
  • i have updated my answer to include an example – Dava Gordon Dec 6 '18 at 15:44
  • 1
    i have updated my answer for m2 and included the info you need to impliment this on add to cart as for the price by group you would need to get your developer to amend the plugin – Dava Gordon Dec 7 '18 at 10:39

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.