I need to modify a block class called in a phtml file, this is the customer.phtml file:

// @codingStandardsIgnoreFile

<?php if($block->customerLoggedIn()): ?>
    <li class="customer-welcome">
        <span class="customer-name"
              data-bind="scope: 'customer'">
            <span data-bind="text: customer().fullname"></span>
            <button type="button"
                    class="action switch"
                <span><?php /* @escapeNotVerified */ echo __('Change')?></span>
        <script type="text/x-magento-init">
            "*": {
                "Magento_Ui/js/core/app": {
                    "components": {
                        "customer": {
                            "component": "Magento_Customer/js/view/customer"
        <?php if($block->getChildHtml()):?>
       <div class="customer-menu" data-target="dropdown">
            <?php echo **$block->getChildHtml()**;?>
        <?php endif; ?>
<?php endif; ?>

I'm interested in the block beetween the div with class customer-menu. I want to remove <ul class="header link"> tag but not their li children, this ul tag is inside the <ul class="header link"> when someone is logged in.

  • Can you specify what actually you want to remove? – Dhiren Vasoya May 15 '19 at 10:33
  • You want to remove the ul class based on customer login/logout action? – aravind May 15 '19 at 10:44
  • The ul tag when a customer is logged in, when it is not logged in the block is not loaded. what is the class of $block->getChildHtml()? – blob May 15 '19 at 10:49

You can check the Customer Block Class in:


  • There is no getChildHtml() method. – blob May 15 '19 at 11:51
  • I think that method is a reserve magento method used to get child block of the parent block – fmsthird May 15 '19 at 13:27

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.