private function getVirtualRootCategory(CategoryInterface $category)
    {
        $storeId      = $this->getStoreId();
        $rootCategory = $this->categoryFactory->create()->setStoreId($storeId);

        if ($category->getVirtualCategoryRoot() !== null && !empty($category->getVirtualCategoryRoot())) {
            $rootCategoryId = $category->getVirtualCategoryRoot();
            $rootCategory->load($rootCategoryId);
        }

        if ($rootCategory && $rootCategory->getId()
            && ($rootCategory->getLevel() < 1 || (int) $rootCategory->getId() === (int) $this->getRootCategoryId($storeId))
        ) {
            $rootCategory = null;
        }

        return $rootCategory;
    }
private function getVirtualRootCategory(CategoryInterface $category)
    {
        $storeId      = $this->getStoreId();
        $rootCategory = $this->categoryFactory->create()->setStoreId($storeId);

        if ($category->getVirtualCategoryRoot() !== null && !empty($category->getVirtualCategoryRoot())) {
            $rootCategoryId = $category->getVirtualCategoryRoot();
            $rootCategory->load($rootCategoryId);
        }

        if ($rootCategory && $rootCategory->getId()
            && ($rootCategory->getLevel() < 1 || (int) $rootCategory->getId() === (int) $this->getRootCategoryId($storeId))
        ) {
            $rootCategory = null;
        }

        return $rootCategory;
    }
private function getVirtualRootCategory ( CategoryInterface $ category ) { $ storeId = $ this -> getStoreId ( ) ; $ rootCategory = $ this -> categoryFactory -> create ( ) -> setStoreId ( $ storeId ) ; if ( $ category -> getVirtualCategoryRoot ( ) !== null && ! empty ( $ category -> getVirtualCategoryRoot ( ) ) ) { $ rootCategoryId = $ category -> getVirtualCategoryRoot ( ) ; $ rootCategory -> load ( $ rootCategoryId ) ; } if ( $ rootCategory && $ rootCategory -> getId ( ) && ( $ rootCategory -> getLevel ( ) < 1 || ( int ) $ rootCategory -> getId ( ) === ( int ) $ this -> getRootCategoryId ( $ storeId ) ) ) { $ rootCategory = null ; } return $ rootCategory ; }
Load the root category used for a virtual category.

@param CategoryInterface $category Virtual category.

@return CategoryInterface
Load the root category used for a virtual category .