1

here am using Magento 2.3 here category displaying category with its ID, enter image description here

How to Hide or Remove these Ids. Can I get help? thank you in advance.

2
  • Hi praveen , can you tell which magento version you are using , i checked it on 2.3.3 and it only show product count . Dec 5, 2020 at 8:18
  • Thank you @Kumar for the response, Am using Magento 2.4.1 Dec 5, 2020 at 8:19

1 Answer 1

0

Go to

  1. vendor/magento/module-catalog/Block/Adminhtml/Category/Tree.php

  2. comment the code

    // $result .= ' (ID: ' . $node->getId() . ')';

on the line 422 at function buildNodeName($node)

public function buildNodeName($node)
{
    $result = $this->escapeHtml($node->getName());
    // $result .= ' (ID: ' . $node->getId() . ')';
    if ($this->_withProductCount) {
        $result .= ' (' . $node->getProductCount() . ')'; 
    }
    return $result;
} 

That would get your job done . Let me know if you face any problem .

Happy Coding :)

NOTE : The right approach would be to overwrite this function in own own module but that would be out of scope for this question for such little tweak.

1
  • Thank you so much, I thought it done by configuration, no Problem ill do it by overriding that file. Dec 5, 2020 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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