0

I am trying to edit the links in the header.phtml file so that it will show and additional link only if logged in.

My issue is it does not seem to work here is my code. The sign up is showing even when logged in??

<?php
 /**
  * @var \Magento\Theme\Block\Html\Header $block
  */
   $welcomeMessage = $block->getWelcome();
 ?>
 <li><a href="about-us" title="About Us">About Us</a></li>
 <li><a href="faq" title="Help">Faq's</a></li>
   <!-- ko ifnot: customer().firstname  -->
    <li><a href="customer/account/create" title="Sign Up">Sign Up</a></li>
   <!-- /ko -->


    <!-- ko if: customer().firstname  -->

    <!-- /ko -->
    <!-- ko ifnot: customer().firstname  -->

    <?= $block->getBlockHtml('header.additional') ?>
    <!-- /ko -->

    <script type="text/x-magento-init">
      {
        "*": {
          "Magento_Ui/js/core/app": {
            "components": {
                "customer": {
                    "component": "Magento_Customer/js/view/customer"
                }
            }
        }
    }
}
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.