category_menu partial

The category_menu.twig partial hosts the sidebar menu of your theme. This is usually shown on the category pages of your website (or brand pages) to easily allow users to view the products belonging to another category or subcategory (or brand).

It is referenced from the category/brand views.


The view will display a menu of the categories and subcategories using the global.categories object.

<h3>Shop by category</h3>
<ul>
    {% for category in categories|default(global.categories) %}
        {% if category.categories %}
            <li class="dropdown">
                <a href="{{ category.url }}">
                    {{ category.title }}
                </a>
                <ul role="menu">
                    {% for subcategory in category.categories %}
                        <li>
                            <a href="{{ subcategory.url }}">{{ subcategory.title }}</a>
                        </li>
                    {% endfor %}
                </ul>
            </li>
        {% else %}
            <li>
                <a href="{{ category.url }}">{{ category.title }}</a>
            </li>
        {% endif %}
    {% endfor %}
</ul>