Forums

Give help. Get help.

  • # February 13, 2018 at 2:35 am

    I am trying to hide add to cart button in Magento 2 as i have implemented all the steps that i have seen in the tutorial https://magenticians.com/hide-add-to-cart-guest-users-magento-2/ but still the button is not hidden. Can any one guide me on this ?

    When i was creating a file apphandles.php i found several issues but i resolve it but still just go through it. Did i done something wrong here ? Why i am not having the right output ?

    use Magento\Framework\Event\Observer;
    use Magento\Framework\Event\ObserverInterface;
    use Magento\Customer\Model\Session as CustomerSession;
    
    class AddHandles implements ObserverInterface
    {
        protected $customerSession;
        public function __construct(CustomerSession $customerSession)
        {
            $this->customerSession
        }
    
        public function execute(\Magento\Framework\Event\Observer $observer)
        {
            $layout = $observer->getEvent()->getLayout();
    
    //To check that customer is logout
            if (!$this->customerSession->isLoggedIn())
            {
                $layout->getUpdate()->addHandle('customer_logged_out');
            }
        }
    }
    
    # February 13, 2018 at 2:45 am

    Hey,

    Did you run the cli commands at the bottom without any errors on the command line?

    You could also try this command:

    php bin/magento setup:static-content:deploy en_GB

    instead of:

    php bin/magento setup:static-content:deploy

    Let me know if you still have issues after this.

    # February 13, 2018 at 2:50 am

    You might also have to run the enable module command first:

    php bin/magento module:enable Magenticians_Mymodule

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag