=== Kabook Product Sales Counter ===
Contributors: SaeidAfshari
Donate link: https://www.kabook.ir
Tags: woocommerce, products, sales, gutenberg, elementor
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show a sortable, AJAX-paginated table of WooCommerce products by sales, price or name — with search, filtering and add to cart.

== Description ==

**Kabook Product Sales Counter** is a lightweight, professional tool for displaying a list of your WooCommerce store products — sorted by real sales count — as an interactive, sortable table.

**Key features:**

* **Real sales count** pulled directly from WooCommerce product meta.
* **AJAX sorting, no page reload:** clicking a column header (name, price, sales) updates the table instantly.
* **AJAX pagination:** products are shown page by page (50 per page by default, configurable) without reloading the page. Neighbouring pages are prefetched and cached in the browser, so previous/next navigation feels instant; a slim progress bar appears only when a page genuinely has to be fetched.
* **Configurable columns:** show or hide the product, price, sales count, row number, category and add-to-cart columns.
* **Shortcode:** `[kabook_product_sales_list]` with `orderby`, `order`, `per_page` and display-column parameters.
* **Dedicated Gutenberg block** with a live preview in the editor and full control over settings from the sidebar panel.
* **Dedicated Elementor widget** offering the same options for page builder users.
* **"Sales" column in the admin Products list**, sortable with a single click.
* **WordPress dashboard widget** showing your top-selling products at a glance.
* **Pre-order (backorder) status** shown automatically next to the product name.
* **One-click add to cart:** simple, in-stock products get an AJAX "+" button; variable, grouped, external and out-of-stock products link straight to the product page.
* **Live AJAX search box** to filter the list by product name as you type.
* **Category column and filter:** see each product's default category at a glance, and narrow the list to one category with a dropdown.
* **In-stock filter:** shoppers can display only products that are currently in stock.
* Every link and form works as a real, plain HTML control first (no JavaScript required), and is enhanced into instant AJAX only when possible — including on AMP pages.
* Fully translation-ready and compatible with right-to-left (RTL) languages.

== Installation ==

1. Upload and activate the plugin (Plugins > Add New > Upload Plugin).
2. Go to **Settings > Kabook Product Sales Counter** and configure the defaults (sort order, items per page, etc.).
3. Display the list using any of the following:
   * The `[kabook_product_sales_list]` shortcode in any post or page.
   * The "Product Sales List" block in the Gutenberg editor.
   * The "Product Sales List" widget in Elementor.

**Note:** the WooCommerce plugin must be installed and active.

== Frequently Asked Questions ==

= Why is only one product showing? =
Check that "Items per page" in the settings (or the `per_page` parameter) is set to a reasonable value, such as 50.

= Can I use the list more than once on the same page? =
Yes. Each shortcode/block instance works independently with its own ID, and sorting/pagination in one instance never affects the others.

= Does this plugin work without WooCommerce? =
No, it relies directly on WooCommerce product data.

= A product is in more than one category — which one shows in the Category column? =
The plugin shows a single "default" category per product: if Yoast SEO or Rank Math has a primary category set for that product, that one is used; otherwise the first category assigned to the product is shown.

== Screenshots ==

1. The product table on the frontend, with AJAX sorting and pagination.
2. Gutenberg block settings in the editor sidebar.
3. Elementor widget settings.
4. The plugin's settings page in the admin dashboard.
5. The sortable "Sales" column in the admin Products list.

== Changelog ==

= 1.0.0 =
* Initial release.
* Sortable, AJAX-paginated product table (sort by name, price or sales), with a working plain-link/no-JS fallback.
* Shortcode, Gutenberg block and Elementor widget, each with full control over the table's settings.
* Live AJAX search box and category filter dropdown.
* Category column showing each product's default category.
* One-click AJAX add-to-cart for simple, in-stock products.
* Pre-order (backorder) badge next to the product name.
* Sortable "Sales" column in the admin Products list.
* Dashboard widget showing top-selling products.
* Translation-ready, with right-to-left (RTL) language support.
