=== Onlinefotka Product-Based Order Filters for WooCommerce ===
Contributors:      onlinefotka
Tags:              woocommerce, orders, filter, products, attributes
Requires at least: 6.0
Tested up to:      7.0
Requires PHP:      7.4
Stable tag:        1.2.5
License:           GPL-2.0-or-later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html

Filter your WooCommerce orders list by product, variation, category, or attribute. Works with both HPOS and legacy order storage.

== Description ==

Have you ever wanted to filter your WooCommerce orders page by a specific product? With this plugin, now you can!

Once installed, new filter dropdowns appear on the WooCommerce Orders screen. Simply select one or more filters and click the **Filter** button to view only the orders that match.

**Filter by:**

* **Product** — search any published product by name; orders containing that product (or any of its variations) will be shown.
* **Variation** — after selecting a variable product, a second dropdown appears letting you narrow down to one specific variation.
* **Category** — show orders containing any product from a chosen product category.
* **Attribute** — pick an attribute type (e.g. Color) and then a value (e.g. Red) to find orders that include a line item with that attribute.

All active filters are combined: only orders matching **every** selected filter will be shown.

**Settings page**

Under **WooCommerce → Order Filter** you can choose which filter dropdowns are visible. Each filter can be enabled or disabled independently.

**Performance**

The product dropdown uses AJAX search — products are loaded on demand as you type, so the orders page stays fast even with thousands of products.

**HPOS compatible**

This plugin is fully compatible with WooCommerce's High-Performance Order Storage (HPOS / custom order tables) as well as the traditional WordPress post-based order storage. No configuration needed — it detects which storage is active automatically.

== Installation ==

1. Upload the `order-filter-by-product` folder to the `/wp-content/plugins/` directory, or install it directly from the WordPress plugin repository.
2. Activate the plugin through the **Plugins** screen in WordPress.
3. Go to **WooCommerce → Orders**. The new filter dropdowns will appear above the orders table.
4. Optionally go to **WooCommerce → Order Filter** to configure which filters are visible.

== Frequently Asked Questions ==

= Does this plugin work with WooCommerce HPOS? =

Yes. The plugin declares HPOS compatibility and uses the correct hooks for both HPOS and legacy (post-based) order storage.

= Can I combine multiple filters at once? =

Yes. If you select a product and a category at the same time, only orders that match both conditions will be shown.

= Does filtering by product also include its variations? =

Yes. When you select a parent product, all of its variations are included automatically. If you want to narrow down to a specific variation, select it in the **Variation** dropdown that appears after picking a variable product.

= Does the plugin slow down the orders page? =

No. The product dropdown uses AJAX — products are loaded on demand, not on page load. The filter query itself uses the indexed `woocommerce_order_items` and `woocommerce_order_itemmeta` tables.

= Can I hide filters I do not need? =

Yes. Go to **WooCommerce → Order Filter** and uncheck any filter you do not want to see.

= Which PHP version is required? =

PHP 7.4 or higher.

== Screenshots ==

1. Filter dropdowns on the WooCommerce Orders screen.
2. Product search dropdown with AJAX autocomplete.
3. Variation dropdown appears after selecting a variable product.
4. Attribute and attribute-value dropdowns for filtering by product attribute.
5. Settings page — enable or disable individual filters.

== Changelog ==

= 1.2.5 =
* Improved: product dropdown is now instant on repeat visits — results cached in browser localStorage for 3 hours.
* Improved: top 3 best-selling products shown first when opening the dropdown.

= 1.2.4 =
* Added: "Our other plugins" sidebar on settings page.
* Added: Buy me a coffee PayPal donate link.
* Added: Slovak, Czech and German translations.
* Fixed: Fatal error when multiple Onlinefotka plugins active simultaneously.

= 1.2.3 =
* Fixed: product search now matches title only, not product description or content.

= 1.2.2 =
* Added: Dashboard widget showing top selling products with order counts and quantities.
* Added: Dashboard widget supports configurable period (7/14/30/90/365 days) and result limit.
* Improved: Full HPOS compatibility for dashboard widget query.

= 1.2.1 =
* Added: plugin banner and icon assets for WordPress.org directory.
* Fixed: contributors list in readme.txt.

= 1.2.0 =
* Added: settings page (WooCommerce → Order Filter) to show/hide individual filters.
* Improved: product dropdown now uses AJAX search — no longer loads all products on page load.
* Improved: selectWoo styling for all filter dropdowns.

= 1.1.0 =
* Added: filter by product variation.
* Added: filter by product attribute and attribute value.
* Improved: multiple active filters are now intersected (AND logic).

= 1.0.0 =
* Initial release.
* Filter orders by product name.
* Filter orders by product category.
* Compatible with HPOS and legacy order storage.

== Upgrade Notice ==

= 1.2.3 =
Fixes product search to match by title only.

= 1.2.2 =
New dashboard widget showing top selling products. Fully compatible with HPOS.

= 1.2.1 =
Minor maintenance update. No functional changes.

= 1.2.0 =
Product search is now AJAX-based for better performance. New settings page to show/hide individual filters.
