=== Nextrays Product Filter ===
Contributors: nextrays
Tags: woocommerce, product filter, ajax filter, price filter, shop filter
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

AJAX product filtering for WooCommerce — categories, price slider, attributes, tags, ratings and stock, with sorting and active-filter chips.

== Description ==

Nextrays Product Filter is the free version of Smart Product Filter Pro by Nextrays. It adds fast AJAX filtering to your WooCommerce shop: shoppers tick categories, drag a price slider, pick attributes, tags or a minimum rating, and the results refresh instantly without a page reload. Active filters show as removable chips, and a clear-all button resets everything in one click.

**Nextrays Product Filter — by Nextrays. Powered by nextrays.com.**

**Features:**

* **9 filter groups** — product categories (hierarchical), price range slider, product attributes (checkboxes), product tags, minimum rating, stock status, on-sale only, featured only, variable products only.
* **AJAX results** — the product grid, pagination and sort toolbar refresh without a reload. Works without JavaScript too: the form submits as a normal GET request.
* **Active-filter chips** — every applied filter shows as a chip that removes just that filter; clear-all resets the whole form.
* **Sorting** — 6 sort options: default, popularity, average rating, latest, price low to high, price high to low.
* **Sidebar layout** — filter beside the results on wide screens, stacked above them on narrow screens.
* **Shop integration** — appears automatically on shop, category and tag pages, or anywhere with the `[nextrays_product_filter]` shortcode.
* **Settings page** — enable or disable each filter group, set the price slider range, results per page, default sort and colours (accent, button, chips).
* **HPOS compatible** — all queries go through `wc_get_products()`; no direct SQL against product tables.
* **No third-party libraries** — jQuery plus the jQuery UI Slider bundled with WordPress core. Nothing is loaded from external servers, and no data leaves your site.

**How it works**

1. Activate the plugin (WooCommerce must be active).
2. Go to Smart Filter > Settings and turn on "Shop & archive pages" — the filter appears on your shop automatically.
3. Or add `[nextrays_product_filter]` to any page. Attributes like `per_page`, `columns` and `categories` narrow it per instance.
4. Choose which filter groups to show on the General tab and set your colours on the Appearance tab.

**Honest limits**

* The free version has one layout (sidebar) and no faceted counts — options do not show how many products they match.
* Filtering does not update the browser URL, so a filtered view cannot be shared as a link.
* There is no keyword search, no brands filter, no custom-taxonomy filters, no widget and no Gutenberg block in the free version.
* On narrow screens the filter stacks above the results; there is no slide-in drawer.

**Upgrade to Smart Product Filter Pro**

Need more? Smart Product Filter Pro adds a brands taxonomy filter, colour swatches and size buttons, custom taxonomy filters, in-product keyword search, a horizontal layout, a mobile slide-in drawer, SEO-friendly URLs (shareable filter links), faceted result counts, a classic widget, a Gutenberg block, and settings import/export. Your filters and settings carry over unchanged — just install Pro over the free version. See the Upgrade tab under Smart Filter > Settings.

== Installation ==

1. Upload the `smart-product-filter` folder to `/wp-content/plugins/` (or install the ZIP from Plugins > Add New > Upload Plugin).
2. Activate the plugin through the Plugins screen. WooCommerce must be active.
3. Go to Smart Filter > Settings, turn on "Shop & archive pages", and choose your filter groups.

No extra setup is required.

== Frequently Asked Questions ==

= Does it need WooCommerce? =

Yes. Nextrays Product Filter filters WooCommerce products, so WooCommerce must be installed and active. Without it the plugin shows a notice in the admin and its frontend features stay disabled; the settings page remains reachable.

= Does it work without JavaScript? =

Yes. The filter is a normal HTML form: with JavaScript disabled, the Apply button submits it as a GET request and the filtered page loads normally. Pagination links keep the filters applied.

= Can I show the filter on one category only? =

Yes. Use the shortcode with the `categories` attribute, for example `[nextrays_product_filter categories="clothing,shoes"]`. The shop integration shows the filter on all shop and archive pages.

= Can I hide a filter group? =

Yes. On the General tab of the settings page, untick any group you do not want — it will never appear in the filter. The shortcode also accepts `show_price="0"` style attributes per instance.

= Does it work with my theme? =

It works with any theme that renders WooCommerce shop and archive pages, including block themes. The shortcode works on any page.

= What happens when I deactivate the plugin? =

Nothing destructive: your settings are preserved, and the shop renders as it did before. Deleting the plugin keeps your settings too, unless you ticked "Delete data on uninstall" on the Advanced tab; products, categories, tags and attributes are never touched.

= What happens to my settings if I upgrade to Smart Product Filter Pro? =

Nothing changes. Pro uses the same folder, settings and option names, so your configuration carries over exactly. Any Pro-only settings you had before (for example a horizontal layout) are preserved while the free version is active and apply again after the upgrade.

= Does it phone home or load anything from outside? =

No. The plugin makes no external requests, loads no third-party libraries, and sends no data anywhere. The only external link is the Upgrade tab's link to the Pro product page, which you click yourself.

== Screenshots ==

1. Shop page with the filter sidebar (desktop).
2. Price slider and attribute filters applied, with active-filter chips.
3. Settings page (General tab).
4. The filter on a shortcode page.
5. Upgrade tab with the Free vs Pro comparison.

== Changelog ==

= 1.0.3 =
* Text domain changed to nextrays-product-filter to match the plugin slug, as required by the directory.
* All internal names now use the nxtprf_ / NXTPRF_ prefix (functions, classes, constants, options, AJAX action, nonce) — the old spf_ prefix was too short. The shortcode is now [nextrays_product_filter].
* Security: colours used in the settings-driven inline CSS are now validated with sanitize_hex_color() when the CSS is generated (esc_attr() alone does not prevent CSS syntax injection). Invalid colours fall back to the defaults.
* Upgrading to Pro: deactivate this free version, install Pro, then delete the free version. Pro 1.0.2 and later migrate your settings automatically.

= 1.0.2 =
* Display name changed to Nextrays Product Filter at the reviewer's request (the previous name was too generic for the directory). No functional changes.

= 1.0.1 =
* Security: pagination links are now built directly from the sanitised filter state; raw request parameters can no longer reach pagination URLs (including via WordPress core's paginate_links, which merges the current URL's query vars into its links).
* Uninstall now keeps your settings by default; data is only removed if "Delete data on uninstall" is ticked on the Advanced tab (protects settings when upgrading to Pro).
* FAQ corrected to match the new uninstall behaviour.

= 1.0.0 =
* Initial release.
* 9 filter groups: categories, price slider, attributes, tags, rating, stock, on-sale, featured, variable-only.
* AJAX results refresh with pagination, sorting (6 options) and active-filter chips.
* Sidebar layout with shop/archive integration and the [nextrays_product_filter] shortcode.
* Settings page with General, Filters, Appearance and Advanced tabs plus an Upgrade tab.
* No-JavaScript fallback: the filter works as a normal GET form.
* HPOS compatible — all product queries go through wc_get_products().
