Category Accordion for WooCommerce

By Themepoints

100+ active installationsVersion 2.0.0

Show WooCommerce product categories and subcategories as an accessible expand/collapse accordion with a block, shortcode or widget.

Description

Category Accordion for WooCommerce turns your product category tree into a clean, fast, accessible accordion for sidebars, shop pages and menus.

Live demo

Features

  • Gutenberg block, shortcode and classic widget
  • Unlimited category depth (or set a max depth)
  • Automatically opens the current category and its parents
  • Single-open or multiple-open mode, default-open options, adjustable animation speed
  • Keyboard accessible: real toggle buttons with aria-expanded and aria-controls; respects reduced-motion settings
  • Parent category links stay clickable – only the arrow toggles the section
  • Include / exclude categories, start from any parent category, hide empty, hide “Uncategorized”
  • Sort by WooCommerce custom order, name, slug, ID or product count
  • Product counts, category images and optional “View all” links
  • Arrow or plus/minus icons (no icon font required), RTL friendly
  • Modern settings page (WooCommerce > Category Accordion) with tabs, a live preview and global defaults
  • Colors and font size via CSS variables
  • Lightweight: one database query for the whole tree, cached; no jQuery; assets load only where the accordion is used
  • Works with WPML and Polylang

Shortcode

[tp_category_accordion]

Example: [tp_category_accordion parent="0" exclude="15,22" show_count="yes" orderby="name" order="ASC" multiple="no" default_open="current" icon="arrow"]

Supported attributes: parent, include, exclude, hide_empty, hide_uncategorized, show_count, show_image, show_view_all, orderby (menu_order, name, slug, id, count), order, max_depth, default_open (current, all, none), multiple, speed, icon (arrow, plus), font_size, text_color, hover_color, active_color, border_color.

Developer hooks

  • tpcafw_args – filter the sanitized settings before rendering
  • tpcafw_html – filter the final HTML

Installation

  1. Upload the plugin folder to /wp-content/plugins/ or install it from the Plugins screen.
  2. Activate the plugin (WooCommerce must be active).
  3. Add the “Category Accordion” block, use the [tp_category_accordion] shortcode, or add the widget under Appearance > Widgets.

FAQ

Does it work with block themes?

Yes. Use the block, or the shortcode inside a Shortcode block.

How do I find a category ID?

Go to Products > Categories and hover over a category: the ID appears in the link (tag_ID=).

My custom CSS stopped working after updating

Version 2.0 uses new class names (.tpcafw-*). The old ul.tp-woo-category-accordion class is still on the list element, but the inner markup changed.

Screenshots

Changelog

2.0.0

  • New: Gutenberg block and [tp_category_accordion] shortcode
  • New: modern tabbed settings page with live preview, unsaved-changes warning and reset to defaults
  • New: include/exclude, start-from-parent, max depth, multiple-open, default-open, animation speed, icons, category images, “View all” links, hide Uncategorized, sort by custom order / count and ASC/DESC
  • New: automatically opens the current category and its parents
  • New: accessible toggle buttons (aria-expanded, keyboard, reduced motion), RTL support
  • Improved: unlimited nesting (3rd level and deeper now expand correctly)
  • Improved: parent category links are now clickable
  • Improved: arrows no longer depend on Font Awesome
  • Improved: one cached query instead of one per category; assets only load when used; jQuery and jQuery UI removed
  • Improved: styling via CSS variables, no inline !important blocks
  • Fixed: correct asset versioning, whitelisted sort values
  • Existing widgets are migrated automatically

1.0.1

  • Update Widget Option
  • Add New Widget Option
  • Fix security Issue.
  • Add Categories Count Number.
  • Fix Color Picker Issue
  • Update CSS File

1.0

  • Initial release