Basic Usage
Place the shortcode in any page, post, text widget, or PHP template to render the accordion:
[WC-Category-Accordion]
Without attributes, the shortcode uses your global settings from WooCommerce → Category Accordion.
Full Attribute Reference
| Attribute | Default | Values | Description |
|---|---|---|---|
theme |
global | light, dark, blue, green, purple, orange, red, teal, slate, rose, indigo, emerald, amber | Visual theme. |
icon |
global | chevron, plus-minus, arrow, folder, caret, dash, triangle, none | Toggle icon style. |
orderby |
global | name, id, slug, order, count | Sort field. |
order |
global | asc, desc | Sort direction. |
hide_empty |
global | yes, no | Hide categories with no products. |
show_count |
global | yes, no | Show product count per category. |
ajax |
global | yes, no | AJAX lazy load child categories. |
max_depth |
global | 0–5 (0 = unlimited) | Maximum nesting depth. |
highlight_current |
global | yes, no | Highlight the active category. |
event |
global | click, hover | Expand trigger. |
exclude |
none | Comma-separated IDs | Category IDs to exclude. |
parent |
0 | Category ID | Show only children of this category ID. 0 = root. |
Examples
Dark theme, sorted by name, with product counts
[WC-Category-Accordion theme="dark" orderby="name" show_count="yes"]
Blue theme, limited to 2 levels, hover to expand
[WC-Category-Accordion theme="blue" max_depth="2" event="hover"]
Exclude specific categories, hide empty ones
[WC-Category-Accordion exclude="12,45,67" hide_empty="yes"]
Show only children of category ID 8
[WC-Category-Accordion parent="8" theme="green" show_count="yes"]
Using the Shortcode in PHP Templates
To output the accordion inside a PHP template file, use do_shortcode():
<?php echo do_shortcode('[WC-Category-Accordion theme="slate" show_count="yes"]'); ?>