Skip to content

Magento 2.4.2: Unable to process binding “ifnot: function(){return customer().fullname }” Message: Unable to parse bindings

The following error is found during the process of upgrading Magento from 2.4.2 to 2.4.4 in console.

Uncaught SyntaxError: Unable to process binding "ifnot: function(){return customer().fullname }"
Message: Unable to parse bindings.
Bindings value: html:

I found out that this error is being caused by this line. <!-- ko ifnot: customer().fullname --> <span class="not-logged-in" data-bind="html: '<?= $escaper->escapeHtmlAttr($welcomeMessage) ?>'"></span> <?= $block->getBlockHtml('header.additional') ?> <!-- /ko -->

The full PHP script containing this code is below

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var MagentoThemeBlockHtmlHeader $block
 * @var MagentoFrameworkEscaper $escaper
 */
$welcomeMessage = $block->getWelcome();
?>
<?php if ($block->getShowPart() == 'welcome') : ?>
    <li class="greet welcome" data-bind="scope: 'customer'">
        <!-- ko if: customer().fullname  -->
        <span class="logged-in"
              data-bind="text: new String('<?= $escaper->escapeHtml(__('Welcome, %1!', '%1')) ?>').replace('%1', customer().fullname)">
        </span>
        <!-- /ko -->
        <!-- ko ifnot: customer().fullname  -->
        <span class="not-logged-in" data-bind="html: '<?= $escaper->escapeHtmlAttr($welcomeMessage) ?>'"></span>
        <?= $block->getBlockHtml('header.additional') ?>
        <!-- /ko -->
    </li>
    <script type="text/x-magento-init">
    {
        "*": {
            "Magento_Ui/js/core/app": {
                "components": {
                    "customer": {
                        "component": "Magento_Customer/js/view/customer"
                    }
                }
            }
        }
    }
    </script>
<?php elseif ($block->getShowPart() == 'other') :?>
    <?= $block->getChildHtml() ?>
<?php endif ?>