I am trying to add to the scope options when calling the data-binds for customer details, ie;

<span id="customer-full-name" data-bind="text: customer().fullname"></span>

so I travel over to /vendor/magento/module-customer/CustomerData/Customer.php

and add (for testing purposes, if successful, just create a module for it):

$customer = $this->currentCustomer->getCustomer();
return [
        'fullname'  => $this->customerViewHelper->getCustomerName($customer),
        'firstname' => $customer->getFirstname(),
        'websiteId' => $customer->getWebsiteId(),
        'groupId'   => $customer->getGroupId(),

However, this doesn't work, nor has any other variations I've tried.

I know in other areas, say the dashboard info area, I can use:

<?= $block->escapeHtml($block->getCustomer()->getGroupId()) ?>

And it will work there, but I am trying to get this achieved in other areas (for specific catered content to specific groups)

Will appreciate the help!

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.