=== CodeBold Smart Filters ===
Contributors: codeboldtech
Tags: woocommerce, filters, product filter, shop, ecommerce
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.1
Requires Plugins: woocommerce
Stable tag: 0.8.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Let shoppers narrow your shop by size, colour, price and availability, in any theme, with or without JavaScript.

== Description ==

Filters for WooCommerce shop and category pages.

* Filters on any product attribute you have created — size, colour, material
* Categories, brands and tags, without turning them into attributes as well
* Price range, in-stock only, and on-sale
* A live count against every option, so nobody clicks their way to an empty page
* Options that would return nothing are shown greyed rather than hidden, so the shop's
  range stays legible
* The shopper's choices live in the address, so a filtered list can be bookmarked,
  shared, and reached with the back button
* Works before JavaScript loads. The script only replaces the results in place so the
  shopper keeps their scroll position

* A search box on any group long enough to need one, so ninety brands is still one you
  can find
* One settings screen, with the panel drawn beside it as you change it — drag the groups
  into the order you want, rename any of them, and see it before you save
* A block for block themes, a widget for sidebars, and an Elementor widget with its own
  Style tab

Placed above the products automatically, or with the widget or the
`[codebold_filters]` shortcode.

The plugin, and the rest of the CodeBold Commerce suite, are at
https://codeboldcommerce.com/smart-filters/ — that is where the documentation lives and
where support is answered.

A CodeBold IT Solutions product. https://codeboldtech.com

== External services ==

This plugin makes no request to any server of ours, ever. There is no licence check, no
registration, no usage tracking and no telemetry. Nothing leaves your site when a shopper
filters your shop, and the plugin contains no code that contacts us at all.

It does load three typefaces from Google Fonts, and only on its own settings screen.

* Service: Google Fonts (https://fonts.googleapis.com and https://fonts.gstatic.com)
* What is loaded: the Archivo, Instrument Sans and JetBrains Mono typefaces
* When: only while a shop administrator has WooCommerce -> Smart Filters open. Never on
  your shop, never on any other admin screen, and never for a shopper
* What is sent: what any browser sends when it fetches a stylesheet, which includes the IP
  address of the administrator viewing that screen. No site data and no shop data is sent
* Why: so the screen is set in the same typefaces as the rest of CodeBold Commerce

Google terms of service: https://policies.google.com/terms
Google privacy policy: https://policies.google.com/privacy

To switch it off, add this line in your theme functions.php or a small plugin of your own.
The screen then uses your system font and makes no external request at all:

`add_filter( 'codebold_filters_admin_fonts', '__return_false' );`

== Installation ==

1. Install and activate.
2. That is all — filters appear on your shop and category pages.
3. WooCommerce, then Smart Filters, to choose what shoppers narrow by, what order the
   groups are in and where the panel goes. The panel is drawn beside the settings as you
   change them.

== Frequently Asked Questions ==

= Does it work with my theme? =

It narrows the theme's own product list rather than drawing its own, so the products
keep looking exactly as your theme draws them.

= Does it need JavaScript? =

No. Every control is an ordinary link. The script is an enhancement that swaps the
results in place instead of reloading.

== Screenshots ==

1. Filters beside the shop, with a live count against every option and the ones that would return nothing greyed rather than hidden
2. Sort and Filter side by side on a phone, where the two questions a shopper has about a list belong together
3. Choosing how to sort without leaving the shop, and without the page reloading under you

== Changelog ==

= 0.8.5 =
* The first version offered publicly. Nothing here changes what the filters do or how
  they look — it is the pass a plugin gets before strangers read it
* Reading the address now removes WordPress own slashes before matching a term. No shop
  will see a difference, because the characters WordPress escapes do not survive into a
  term slug in the first place; it is correct rather than lucky, which is the standard
  the directory holds a plugin to
* The uninstall routine no longer writes to $blog_id while it runs. On a network it
  visits every site in turn, and the loop was assigning to WordPress own global — the
  same one switch_to_blog() and restore_current_blog() manage between those lines
* Term ids reach the counting queries as placeholders rather than written into the
  statement already cast. The query is identical; the difference is that a reader can see
  it is prepared without first tracing where the ids came from
* Translations are left to WordPress, which has loaded them for plugins in the directory
  since 4.6, and does it at the first string rather than on every page. The plugin was
  loading a second copy eagerly
* The settings screen now says who made it and where the documentation is
* The plugin header pointed at a domain that no longer resolves
* Every external request the plugin makes is now written down in the readme. There is one:
  three typefaces on the settings screen, and a filter that turns it off
* Each hand-written query now carries, in the source beside it, why it is written that
  way — which values are placeholders, which are table aliases that cannot be, and where
  the caching happens. Static analysis reads one function at a time and could not tell;
  a person reading the code should not have to work it out either

= 0.8.3 =
* A sweep for the rest of the same bug, rather than waiting to be shown each one. What is
  written on top of the accent colour is now a setting of its own: white is right on the
  default blue and unreadable on a bright green, so a chosen size chip, the price Go
  button and the count on the filter button all follow one property instead of five
  hardcoded whites
* The dark panel style tells the browser it is dark, so the price range's arrows, the
  search box's clear button and any scrollbar inside it are drawn to match
* On the settings screen: placeholder text, text selection, the dismiss cross on our own
  notice, a read-only licence field, and the focus ring WordPress draws in its own blue
* Autofill no longer turns a field white. Chrome paints a saved value with its own
  near-white background and there is no property that overrides it — it has to be drawn
  over, which it now is

= 0.8.2 =
* The dropdowns on the settings screen were unreadable: a select was given a dark
  background, and the browser kept drawing its options in the default dark ink on top of
  it. Everything the browser paints for itself — select menus, number field arrows,
  scrollbars — is now told the surface is dark

= 0.8.1 =
* An extension point after the settings form closes, so an add-on can carry a form of
  its own — a licence key field, for one. A form inside a form is not a thing HTML has

= 0.8.0 =
* Filters of your own. An add-on — or a shop with a developer — can register a filter on
  anything, and the panel draws it, counts it, clears it and narrows the shop with it
  exactly as it does its own. See the FilterType class
* Counts take registered filters into account, in both directions: they are counted like
  every other group, and every other group is counted against them
* Larger type and stronger contrast on the settings screen. Nothing smaller than 12.5px,
  body text at 15.5px, and labels off the faintest ink — it is read by shopkeepers, some
  of them for an hour at a time, and it was too small
* Other plugins' admin notices are left alone. WordPress moves every notice on the page
  inside this screen's wrapper, and the dark styling was repainting them in our colours —
  a warning from another plugin arrived wearing our green

= 0.7.0 =
* The settings screen is now a dark console in CodeBold Commerce's own colours and
  typefaces, sitting inside the WordPress admin it belongs to
* A Panel style setting for the shop front: "Match my theme", which is the default and
  what it has always done, or "CodeBold dark". Colours only — the panel keeps your
  shop's typeface either way, because a plugin's fonts are not a cost a shopper should
  pay for on a product page

= 0.6.1 =
* A Pro tab on the settings screen, listing what a paid version would add. One tab,
  reached by choosing it: no dashboard banner, no dismissible notice on somebody else's
  screen, and nothing greyed out in the middle of a setting that works

= 0.6.0 =
* Filter by category, brand and tag. Every shop already has these and the panel could
  offer none of them, so a shop selling four brands had to make Brand an attribute as
  well and keep the two in step by hand
* A parent category is counted across everything filed beneath it. Clicking one returns
  the whole branch, so counting only what is filed directly against it promised one
  number and delivered another — usually zero, on a shop that files at the leaves
* The counts are worked out for the whole panel in one query instead of one per group,
  each of which used to pull every matching product id through PHP. Four queries became
  one; eight became three
* Counts now take In stock and On sale into account. They did not, so with "In stock
  only" ticked the number beside an option said eleven where the shopper was about to be
  shown four
* A new settings screen: three tabs, groups you can drag into order, a name of your own
  for any of them, a plain-language account of where the filters will appear, and the
  panel drawn beside the settings as you change them
* A search box on any group with more than a dozen options
* A Product Filters block for block themes
* The Elementor widget now offers categories and brands as well as attributes, a sort
  toggle, its own "show more" threshold, and typography and colour in the Style tab
* Sort can be turned off where a theme already has its own

= 0.5.4 =
* Group headings are styled by their class rather than by the element carrying it. A
  group that cannot collapse renders a heading instead of a button, and only the button
  was styled — so on any theme that sizes its headings, that one group appeared several
  times larger than its neighbours

= 0.1.0 =
* First release.
