If you've tried using the hierarchicalMenu widget's rootPath parameter but no items were returned this article will help explain why.
In order for the rootPath
parameter to work you need to have an active refinement on at least the value set in rootPath
for it to show a hierarchy.
You can achieve this in a filtered category page by setting an initialUiState
, like this for example:
initialUiState={{
instant_search: {
hierarchicalMenu: {
"hierarchicalCategories.lvl0": ["Computers & Tablets"]
}
}
}}
To see how this works in a live environment we've put together this CodeSandBox. More on how initialUiState works can be found here in our documentation.