=== Per Category Product Ordering ===
Contributors: luminosagency
Tags: woocommerce, sorting, product category, merchandising, menu order
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Requires Plugins: woocommerce

Drag-and-drop product ordering for each WooCommerce category, applied on the category page when shoppers use "Default sorting".

== Description ==

**Per Category Product Ordering** gives you a dedicated, focused screen to arrange products inside each WooCommerce category exactly the way you want them, by dragging and dropping. Lead with your best sellers, push seasonal items to the top, group related products together, or feature high-margin items first, one category at a time.

Your custom order is applied on the category archive only when the shopper is viewing with **Default sorting** (menu order). The moment a visitor chooses Price, Popularity, Rating, or Latest, WooCommerce takes over again, so you never fight your customers' own sorting choices.

= What you can do =

* Open any product category and see all of its products in one sortable list.
* Drag products into the precise order you want, then save with one click (no page reload).
* See a thumbnail, product name, SKU, stock status, and price for every product, so you are merchandising with the full picture in front of you.
* Filter the list as you type to find a product fast in large categories.
* Turn the custom order on or off per category with a single switch, without losing the arrangement you saved.
* Tell at a glance which categories already have a custom order, right from the category picker.

= How it works =

The plugin stores a saved order and an on/off flag per category (as term meta on each `product_cat`). On the front end it adjusts the ordering of that category's archive page only, and only for the "Default sorting" option. The ordering change is scoped to the page's main query, so your related products, up-sells, cross-sells, and product widgets keep their normal behavior. Nothing else on your store is touched.

= Why not just use global menu order? =

Global menu order changes ordering everywhere at once and is awkward to manage product by product. This plugin lets you curate specific categories on their own, without changing your global product order and without overriding the sort options your shoppers select.

= Built to be safe and lightweight =

* No global settings page and no bloat. One screen under WooCommerce, scoped assets that load only there.
* Reads products efficiently and never alters core WooCommerce data destructively.
* Translation ready.
* Clean uninstall: removes its saved settings if you delete the plugin.

= Trademarks =

WordPress is a registered trademark of the WordPress Foundation. WooCommerce is
a trademark of Automattic Inc. Luminos Agency is not affiliated with, endorsed
by, or sponsored by the WordPress Foundation or Automattic Inc.; these names are
used only to describe compatibility.

== Installation ==

1. Install and activate WooCommerce.
2. Upload the plugin to `wp-content/plugins`, or install it from the Plugins screen, then activate it.
3. Go to **WooCommerce > Category Ordering**.
4. Choose a category, drag products into your preferred order, toggle the order on, and click **Save Order**.

== Frequently Asked Questions ==

= Does this change ordering everywhere on my store? =
No. It only changes the order on **product category archive pages**, and only when the shopper's sort is **Default sorting**. Other categories and other sort options are unaffected.

= Will it interfere with related products, up-sells, or product widgets? =
No. The ordering is scoped to the category page's main query, so secondary product lists (related products, up-sells, cross-sells, widgets) keep their normal order.

= What happens when a shopper sorts by price or popularity? =
Your custom order steps aside and WooCommerce's native sorting takes over. Your saved order returns automatically the next time the category is viewed with Default sorting.

= Where is the order stored? =
As term meta on each product category (`_pcpo_enable` and `_pcpo_order`). New products that are not yet in your saved order simply appear after the ones you have arranged.

= What happens if I disable or delete the plugin? =
Disabling reverts the store to WooCommerce's normal ordering with no front-end breakage. Deleting the plugin runs an uninstall routine that removes the per-category settings it stored.

= Is it translatable? =
Yes. All strings are prepared for translation.

== Screenshots ==
1. Category picker with the sortable product table.
2. Drag-and-drop reordering with thumbnail, SKU, stock, and price columns.

== Changelog ==
= 1.0.3 =
* Compliance: bumped "Tested up to" to WordPress 7.0.
* Docs: expanded the plugin description and FAQ.
* Housekeeping: wrapped the uninstall routine in a function so it leaves no variables in the global scope (passes Plugin Check cleanly).

= 1.0.2 =
* Fix: the custom order no longer leaks into related-product, up-sell, or widget queries on the category page. The order rewrite is now scoped to the page's main query only.
* Security: the AJAX save now confirms the target is a real product category before writing term meta.
* Admin UI: refreshed the Category Ordering screen with the Luminos admin design (clearer hero, enable toggle, stock chips, tidier product table) and a marker in the category picker for categories that already have a custom order.
* Housekeeping: removed dead code and a duplicate capability check; only loads assets and hides unrelated admin notices on its own screen.

= 1.0.1 =
Security: verify nonce and capability inside the admin render callback before reading GET input.
Security: keep AJAX save protected with capability + nonce checks.

= 1.0.0 =
Initial public release.
