Product catalog filters in WordPress
A faceted filter panel for a catalog: category, price, size, colour and stock, with a result counter, active filter chips, sorting and a mobile drawer.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Filtres de catalogue produits
* Description: Un panneau de filtres à facettes pour un catalogue : catégorie, prix, taille, couleur et stock, avec compteur de résultats, puces des filtres actifs, tri et tiroir sur mobile. Ajoute la composition « Filtres de catalogue produits » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-filtres-catalogue-produits
*<!-- wp:html -->
<div class="pcf" data-pcf>
<div class="pcf__head" data-pcf-outside>
<p class="pcf__eyebrow">Atelier Garance · Vêtements en lin</p>
<h2 class="pcf__title">Collection automne</h2>
<p class="pcf__intro">Douze pièces en lin lavé, cousues à Roubaix. Affinez la sélection par catégorie, prix, taille ou coloris.</p>
</div>
<div class="pcf__toolbar" data-pcf-outside>
<button class="pcf__toggle" type="button" aria-expanded="false" aria-controls="pcf-panel" data-pcf-toggle data-pcf-enhanced hidden>
<svg viewBox="0 0 20 20" width="18" height="18" aria-hidden="true" focusable="false"><path d="M3 5h14M6 10h8M8.5 15h3" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
Filtres
<span class="pcf__badge" hidden><span data-pcf-badge>0</span><span class="pcf__sr" data-pcf-badge-word> actifs</span></span>(() => {
if (!document.querySelector(".pcf")) return;
const PCF_X = '<svg viewBox="0 0 20 20" width="14" height="14" aria-hidden="true" focusable="false"><path d="M5 5l10 10M15 5L5 15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" /></svg>';
document.querySelectorAll("[data-pcf]").forEach((root) => {
const form = root.querySelector("[data-pcf-form]");
const panel = root.querySelector("[data-pcf-panel]");
const toggle = root.querySelector("[data-pcf-toggle]");
const badge = root.querySelector("[data-pcf-badge]");
const backdrop = root.querySelector("[data-pcf-backdrop]");
const list = root.querySelector("[data-pcf-list]");
const items = [...list.children];:root {
--pcf-card: #ffffff;
--pcf-text: #1f2421;
--pcf-muted: #59615b;
--pcf-line: #e2e5df;
--pcf-line-strong: #7d867f;
--pcf-field: #ffffff;
--pcf-hover: #f4f5f1;
--pcf-accent: #3d5a3f;
--pcf-accent-hover: #2f4731;
--pcf-accent-soft: #eef3ec;
--pcf-accent-soft-hover: #dde8da;Free component: copy it freely, including for commercial projects.
Other e-commerce components in WordPress
E-commerce components in WordPress
A limited-time offer bar: countdown to a fixed date, one-click copyable promo code and a fallback message once the offer is over.
- Tailwind
- React
- CSS
- WordPress

A sales card showing the discount that grows with the cart amount (-10% from €50, -15% from €100…) with a progress bar towards the next tier.
- Tailwind
- React
- CSS
- WordPress

A Christmas gift guide filtered by budget and theme, with the number of ideas announced and an empty state offering to show everything again.
- Tailwind
- React
- CSS
- WordPress

The last order dates for delivery before Christmas, per shipping method, with the days left worked out from the visitor’s date.
- Tailwind
- React
- CSS
- WordPress

A cart that shows live how much is left to add for free shipping, with a progress bar and recalculated totals.
- Tailwind
- React
- CSS
- WordPress

A colour and size picker for a product page: the visual, price and stock follow the choice, and sold-out sizes are disabled.
- Tailwind
- React
- CSS
- WordPress