Skip to content

shortcode-based AJAX product filter for WooCommerce. Instantly filter products by category, color, price, and text search—without reloading the page

Notifications You must be signed in to change notification settings

alexander-wei/wei-ajax-search

Repository files navigation

WooCommerce AJAX Products Filter

A WordPress plugin providing a shortcode-based AJAX product filter for WooCommerce. Instantly filter products by category, color, price, and text search—without reloading the page.


Features

  • AJAX-powered: Instantly updates the product list without a page reload.
  • Shortcode-based: Easily add the filter form anywhere using [wei_ajax_search].
  • Multiple filter types: Filter by category, color attribute, price range, and text search.
  • URL sync: Filter state is reflected in the URL and restored on reload.
  • Theme-agnostic: Works with any WooCommerce-compatible theme.

Requirements

  • WordPress
  • WooCommerce

Installation

  1. Upload the plugin to your wp-content/plugins directory.
  2. Activate the plugin via the WordPress admin dashboard.
  3. Ensure WooCommerce is active.

Usage

  1. Add the filter form to any page or post using the shortcode:

    [wei_ajax_search]
    
  2. The filter form will appear. The filtered product list will be updated in your theme's product container (e.g., .products).

    Note: The plugin does not display products directly in the widget area; it updates the product list container outside the filter form.


Screenshots

Shortcode Embedding AJAX Filter AJAX Filtered

Technical Overview

  • Registers the [wei_ajax_search] shortcode, which outputs a filter form with text, category, price, and color widgets.
  • Uses jQuery and AJAX to submit filter changes and update the product list dynamically.
  • Filter state is synchronized with the URL for shareable/filterable links.
  • Extensible via PHP classes in src/Widgets/ for custom filter widgets.

File Structure

  • wei-ajax-search.php — Main plugin file
  • assets/js/filter.js — AJAX and filter logic
  • assets/css/style.css — Styles for the filter form
  • src/ — PHP source code (widgets, AJAX handler, assets registration)

Credits & License

  • Author: Alexander Wei
  • License: as-is

About

shortcode-based AJAX product filter for WooCommerce. Instantly filter products by category, color, price, and text search—without reloading the page

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published