Search code examples
opencart-3

How to hide a button or a section in TWIG if not logged in OpenCart 3.x?


I need to hide a button and section in section in cart page of OpenCart 3.x. There is no TWIG code found for if customer logged in. Can anyone please give me a section to do it?

Thanks in Advance


Solution

  • Yes, I can do it by declaring the logged in value into a variable like below.

    In controller:

    $data['loggedin'] = $this->customer->isLogged();
    

    In View:

    {% if loggedin %}
    <sections> or Whatever
    {% endif %}