We have a B2B registration with the options dealer, corporate and employee on our website. Customer can register any one of the option by filling the corresponding form.

Now what I wanted to implement is when a customer completed his/her registration, I want to show separate My Account dashboard with necessary links. How can I do that?

enter image description here

Any help will be appreciated.

  • You mean you want to hide some tabs which is coming in left sidebar for some customer groups and display new tabs for some customers. Am I right ? Oct 21, 2019 at 6:17
  • Yes, you're right. But I want to redirect to the corresponding My Account dashboard when the customer complete registration
    – MagentoDev
    Oct 21, 2019 at 6:18
  • Okay for tabs you can add conditions, and for dashboard page you can create different phtml template files and you can put conditions based on group and display accordingly. Oct 21, 2019 at 6:22
  • What you want to change in dashboard? Can you please attach screenshots in question? So I can update you. Oct 21, 2019 at 6:52
  • 1
    @KishanSavaliya, I'm working on that. Update you shortly
    – MagentoDev
    Oct 22, 2019 at 14:38

2 Answers 2


Here, I'll explain you this with one example.

We will need to display My Wishlist link only for B2C Customer and B2C Employee customer groups and not in B2B Dealer and B2B Corporate.

  • All Sidebar links, we can find here in customer_account.xml in different modules under customer_account_navigation container.

Like if you want to find My Wishlist link then you check this file..


My Account link located here in this file..


My Orders link located here in this file..


  • So I think now you get idea how sidebar links are working. And you need to add any new links there then you can add that there.

So we will create this file here


Here we need to change Class name for wishlist link and we will add new Class name there. So we can not change class name with referenceBlock so we will override class with block itself. So just copy entire block from there and add that in custom theme's customer_account.xml file and update your class name.

Content for above file is ...

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="customer_account_navigation">
            <block class="Vendor\Module\Block\Account\WishlistLink" ifconfig="wishlist/general/active" name="customer-account-navigation-wish-list-link">
                    <argument name="path" xsi:type="string">wishlist</argument>
                    <argument name="label" xsi:type="string" translate="true">My Wish List</argument>
                    <argument name="sortOrder" xsi:type="number">210</argument>
  • Here I've changed Block's class name from Magento\Customer\Block\Account\SortLinkInterface to Vendor\Module\Block\Account\WishlistLink.

So now we need to create one Block file in our custom module here


Content for this file is ..

namespace Vendor\Module\Block\Account;

class WishlistLink extends \Magento\Framework\View\Element\Html\Link\Current
    protected $_customerSession;

    protected $customerGroup;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\Framework\App\DefaultPathInterface $defaultPath,
        \Magento\Customer\Model\Session $customerSession,
        \Magento\Customer\Model\ResourceModel\Group\Collection $customerGroup,
        array $data = []
     ) {
         $this->_customerSession = $customerSession;
         $this->customerGroup = $customerGroup;
         parent::__construct($context, $defaultPath, $data);

    protected function _toHtml()
        $customerGroupId = $this->_customerSession->getCustomerGroupId();
        $customerGroups = $this->customerGroup->toOptionArray();

        foreach ($customerGroups as $customerGroup) {
            if($customerGroup['value'] == $customerGroupId){
                $currentCustomerGroup = $customerGroup['label'];

        if($this->_customerSession->isLoggedIn()) {
            if(in_array($currentCustomerGroup, array("B2C Customer", "B2C Employee"))) {
                return parent::_toHtml();
            } else {
  • Here in this file I've added Customer Group's Condition. So now if any customer has B2C Customer and B2C Employee Group that customer only can see "My Wishlist" link in account dashboard page.

You can do same thing for different links same as above. You can create different Block files and you can override multiple block's class name in xml file.

Hope this will help you!

  • Thanks. It's very descriptive. Hopefully I will get the output. Update you once done
    – MagentoDev
    Oct 23, 2019 at 13:57
  • Okay no problem @Siva Oct 23, 2019 at 14:07
  • What I have to put in value at if($customerGroup['value'] == $customerGroupId){ $currentCustomerGroup = $customerGroup['label']; }
    – MagentoDev
    Oct 23, 2019 at 18:30
  • 1
    Okay I'll send you a link within few mins. You can download that module and you can check. Oct 24, 2019 at 4:11
  • 1
    Approve my answer and give me an upvote if above solution is helpful to you. Thanks in advance! :) Oct 26, 2019 at 6:53

You have multiple options for this approach.

  1. You can override my Account Page and Customize.


  2. You can add new page and set default open to that corresponding page.


  3. You can also create one module for setting up menus visibilty option according to your user group.

Hope this will help you!!

  • Thanks. Since there are multiple approaches, I would like to know which one is good?
    – MagentoDev
    Oct 21, 2019 at 6:40
  • I think last one approach is good, set menus visibility according to user and also set default page for all of them(according to level). Oct 21, 2019 at 6:42
  • I think add new pages and set default open is easy approach. Please guide
    – MagentoDev
    Oct 21, 2019 at 6:42
  • Yes, you can go with second approach as well, this is very easy and time consuming approach. Oct 21, 2019 at 6:43
  • Can you please explain bit more if I go with option 3?
    – MagentoDev
    Oct 21, 2019 at 11:47

Your Answer

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

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