=== Ni Order Filter For WooCommerce ===
Contributors: anzia
Tags: woocommerce, order filter, hpos, order management, orders
Requires at least: 4.7
Tested up to: 6.6.1
Requires PHP: 7.0
Stable tag: 1.0.8
WC requires at least: 3.0.0
WC tested up to: 9.1.4
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/agpl-3.0.html

Filter WooCommerce orders by product, category, country, payment method, coupon & shipping method. Fully HPOS compatible.

== Description ==

**Ni Order Filter For WooCommerce** is a lightweight WooCommerce order filter plugin that adds the extra filter dropdowns WooCommerce leaves out of its admin Orders screen. Instead of scrolling through pages of orders or relying on the basic search box, store managers can filter WooCommerce orders in a couple of clicks and get straight to the orders that matter.

= Why store owners install this WooCommerce order filter plugin =

* **Save time on order management** — stop scrolling and searching manually; filter directly from dropdown menus.
* **Find orders for a specific product fast** — useful during stock checks, recalls, or when a customer asks about a specific item.
* **Spot coupon usage at a glance** — filter orders by coupon code to review promotions and discount performance.
* **No extra settings screen to learn** — the filters appear right on the WooCommerce Orders screen you already use every day.
* **Works with your existing order storage** — fully compatible with both HPOS (High-Performance Order Storage) and legacy WooCommerce order storage.

= Filter WooCommerce orders by =

* **Product** — filter orders that contain a specific product. Selecting a product matches orders containing any variation of it.
* **Product Category** — filter orders that contain a product from a specific product category.
* **Billing Country** — filter orders by the customer's billing country.
* **Payment Method** — filter orders by the payment method used at checkout (e.g. COD, bank transfer, card).
* **Coupon Code** — filter orders where a specific coupon was applied.
* **Shipping Method** — filter orders by the shipping method chosen at checkout.

All of the above filters can be combined with each other and with WooCommerce's own order status filter and search box, so you can, for example, find every *on-hold* order that used a specific coupon and shipping method in one view.

= Built for WooCommerce High-Performance Order Storage (HPOS) =

WooCommerce order filtering only helps if it keeps working as WooCommerce evolves. This plugin detects your store's order storage mode automatically and runs the correct, optimized queries whether your store uses:

* WooCommerce HPOS (Custom Order Tables), or
* Legacy, post-based WooCommerce order storage.

No configuration is required — HPOS compatibility is declared automatically and the right code path is used behind the scenes.

= Lightweight by design =

The plugin only loads its filtering code on the WooCommerce Orders screen — not on every wp-admin page — and only adds the extra dropdowns and queries needed to filter orders. It does not modify any WooCommerce or WordPress core files.

== Installation ==

1. Upload the `ni-order-filter-for-woocommerce` folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress plugins screen directly (Plugins → Add New → search "Ni Order Filter For WooCommerce").
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Make sure WooCommerce is installed and active.
4. Go to WooCommerce → Orders. The additional order filter dropdowns appear above the orders list, ready to use.

== Frequently Asked Questions ==

= How do I filter WooCommerce orders by product? =

Go to WooCommerce → Orders and use the "Filter by order product" dropdown. Selecting a product shows only orders that contain that product, including orders for any of its variations.

= How do I filter WooCommerce orders by country? =

Use the "Filter by order country" dropdown on the WooCommerce Orders screen to show only orders with a matching billing country.

= Can I filter WooCommerce orders by coupon code? =

Yes. The "Filter by order coupon" dropdown lists every coupon code that has been used on an order, so you can see exactly which orders redeemed a given coupon.

= Can I filter orders by payment method or shipping method? =

Yes, both are supported as separate dropdown filters on the Orders screen, in addition to product, category, country, and coupon filtering.

= Does this plugin require WooCommerce? =

Yes. WooCommerce must be installed and active. An admin notice is shown if WooCommerce is not active.

= Is this plugin compatible with WooCommerce HPOS (High-Performance Order Storage)? =

Yes. The plugin detects whether HPOS is enabled and automatically uses the correct WooCommerce order storage APIs and queries for either HPOS or legacy (post-based) order storage, so your order filters keep working after enabling HPOS.

= Does the product filter work correctly with variable products? =

Yes. Selecting a variable product in the filter dropdown matches orders containing any of its variations, so you don't need to filter each variation separately.

= Can I combine multiple order filters at the same time? =

Yes, the filters can be combined with each other, with the order status filter, and with the order search box, to narrow results down to exactly the orders you need.

= Does this plugin modify any WooCommerce or WordPress core files? =

No. The plugin only hooks into standard WooCommerce/WordPress actions and filters; it does not modify core or WooCommerce files.

= Will this plugin slow down my WooCommerce Orders screen? =

No. The filtering code only loads on the WooCommerce Orders screen, and filters are only applied to the order query when you actually select one, so there is no added overhead on the rest of your site.

== Screenshots ==

1. Additional order filter dropdowns (product, category, country, payment method, coupon, shipping) on the WooCommerce Orders screen.

== Changelog ==

= 1.0.8 =
* Fixed SQL injection issues in the HPOS order query filters for Coupon, Shipping, and Product Category.
* Fixed a bug where combining two or more of the item-based filters (Product, Coupon, Shipping, Product Category) could break the Orders screen due to duplicate SQL table aliases.
* Fixed a bug where a filter's own JOIN clause could overwrite JOINs added elsewhere on the HPOS Orders query, breaking combined filtering.
* Fixed a bug where the plugin's filters could load on unrelated wp-admin pages.
* Fixed the Product filter showing a separate dropdown entry per product variation; it now shows one entry per product and matches orders containing any of its variations.
* Fixed a PHP warning when an invalid `product_id` filter value was supplied.
* Fixed the "WooCommerce required" admin notice rendering as escaped text instead of a styled notice.

= 1.0.7 =
* Previous stable release.

For the full version history, see the plugin page on WordPress.org.

== Upgrade Notice ==

= 1.0.8 =
Includes security and reliability fixes for the WooCommerce order filters, including SQL injection fixes and combined-filter reliability fixes. Update recommended.
