2026-03-29 15:19:53 +02:00
|
|
|
{#
|
|
|
|
|
# Product Category Tree (Bootstrap 5)
|
|
|
|
|
#
|
2026-03-29 15:42:35 +02:00
|
|
|
# Renders a hierarchical product category navigation using Bootstrap
|
|
|
|
|
# list-group with nested sub-lists and action links.
|
2026-03-29 15:19:53 +02:00
|
|
|
#
|
|
|
|
|
# Expected context:
|
2026-03-29 15:42:35 +02:00
|
|
|
# categories - Hierarchical array from wc_bootstrap_get_category_tree()
|
|
|
|
|
# shop_url - URL to the main shop page
|
|
|
|
|
# current_cat - Term ID of the currently viewed category (0 = shop page)
|
2026-03-29 15:19:53 +02:00
|
|
|
#
|
|
|
|
|
# @package WcBootstrap
|
|
|
|
|
# @since 0.1.7
|
|
|
|
|
#}
|
|
|
|
|
|
|
|
|
|
{% if categories is not empty %}
|
|
|
|
|
<nav aria-label="{{ __('Product categories', 'wc-bootstrap') }}">
|
|
|
|
|
<h3 class="sidebar-heading h6 text-uppercase fw-semibold">
|
|
|
|
|
{{ __('Categories', 'wc-bootstrap') }}
|
|
|
|
|
</h3>
|
|
|
|
|
|
2026-03-29 15:42:35 +02:00
|
|
|
<div class="list-group list-group-flush category-tree">
|
|
|
|
|
<a href="{{ shop_url }}"
|
|
|
|
|
class="list-group-item list-group-item-action border-0 px-2 py-1{% if current_cat == 0 %} active{% endif %}">
|
|
|
|
|
{{ __('All products', 'wc-bootstrap') }}
|
|
|
|
|
</a>
|
2026-03-29 15:19:53 +02:00
|
|
|
{% for cat in categories %}
|
|
|
|
|
{% include 'global/category-tree-node.html.twig' with { node: cat, level: 1 } only %}
|
|
|
|
|
{% endfor %}
|
2026-03-29 15:42:35 +02:00
|
|
|
</div>
|
2026-03-29 15:19:53 +02:00
|
|
|
</nav>
|
|
|
|
|
{% endif %}
|