=== Simple Product Table for WooCommerce ===
Contributors: bluegamediversion
Tags: woocommerce, product table, order form, wholesale, bulk order
Requires at least: 5.9
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0.0
WC tested up to: 10.8
Stable tag: 1.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Turn WooCommerce products into a fast, searchable order-form table. Bulk add to cart, category filter, custom columns — ideal for wholesale & B2B.

== Description ==

**Simple Product Table for WooCommerce** replaces slow, click-heavy shopping with a single, scannable table. Your customers search, sort, filter, set quantities and add several products to the cart at once — without ever leaving the page.

Perfect for **wholesale and B2B quick-order forms**, **restaurant and food menus**, **distributor and spare-parts catalogs**, and any store where people buy many items in one go.

Create your first table in under 2 minutes — no page builder, no code.

= Quick start =

1. Install and activate the plugin (WooCommerce must be active).
2. Go to **Simple Product Table → Add New Table**, choose your columns (name, price, quantity, add-to-cart…) and click **Publish**.
3. Pick the products: assign a **Product List**, or add `category="your-category"` to the shortcode to pull them in automatically.
4. Copy the shortcode shown on the table screen (e.g. `[sptable id="42"]`) and paste it on any page or post. Done!

= Why store owners choose it =

* **Sell faster** — one table, one click, many products in the cart.
* **Less friction** — no jumping between product pages.
* **Looks professional** — a clean, modern, mobile-friendly layout out of the box.
* **You stay in control** — pick the columns, the products and the wording.

= Key features =

* **One-click quick order** — a checkbox on every row plus an **"Add all to cart"** button to add several products in a single click.
* **AJAX add to cart** — products drop into the cart instantly, with no page reload.
* **Instant search, sort & pagination** — powered by DataTables.
* **Filter by category** — a dropdown above the table lets shoppers narrow the list in one click.
* **Column builder** — show exactly what you need: product name, thumbnail, price, quantity input, add-to-cart button, **SKU**, **short description**, **category** and **stock status**.
* **Custom labels** — rename any column header and the "Add to cart" button to match your store.
* **Two ways to fill a table** — hand-pick products with reusable **Product Lists**, or pull them in automatically by **category or tag** straight from the shortcode.
* **Mobile responsive** — on small screens the table turns into tidy, stacked cards.
* **Works for everyone** — guests and logged-in customers can both order.
* **Multiple tables per page** — show different selections wherever you like.

= How it works =

1. Go to **Simple Product Table → Products Lists** and create a list by selecting the products to include (or skip this and use a category/tag in the shortcode).
2. Go to **Simple Product Table → Add New Table**, choose your columns and assign a product list.
3. Click the shortcode to copy it (e.g. `[sptable id="42"]`) and paste it on any page or post.

= Shortcode options =

* `[sptable id="42"]` — show the table and its assigned product list.
* `[sptable id="42" category="t-shirts"]` — fill the table with products from a category (slug). Combine several with commas.
* `[sptable id="42" tag="sale"]` — fill the table with products from a tag (slug).

= Use cases =

* Wholesale / B2B quick-order forms
* Restaurant and food menus with direct add-to-cart
* Distributor and reseller catalogs
* Spare-parts and large product lists
* Any store selling multiple products at once

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install it from **Plugins → Add New**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Make sure WooCommerce is installed and active — the plugin shows a notice if it is not.
4. Go to **Simple Product Table → Products Lists** to create your first list (optional if you use a category/tag).
5. Go to **Simple Product Table → Add New Table** to choose columns and assign a list.
6. Copy the generated shortcode and paste it on any page or post.

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. WooCommerce must be installed and active. The plugin shows an admin notice and stops loading if WooCommerce is not detected.

= How do I choose which products appear in a table? =

Two ways. Create a **Product List** and assign it to the table, or pass a **category** or **tag** slug in the shortcode, e.g. `[sptable id="42" category="coffee"]`. A category or tag in the shortcode takes priority over the assigned list.

= Can customers add several products at once? =

Yes. When the table has an "Add to cart" column, every row gets a checkbox and an **"Add all to cart"** button appears. Customers tick the products they want, set quantities, and add them all in one click.

= Which columns can I show? =

Product name, thumbnail, price, quantity input, add-to-cart button, SKU, short description, category and stock status. You can reorder them and rename each column header.

= Can I change the "Add to cart" button text? =

Yes. Go to **Simple Product Table → Settings → Display** and set your own label.

= Can I display multiple tables on the same page? =

Yes. Use as many `[sptable id="X"]` shortcodes as you like, each pointing to a different table.

= Is the table mobile friendly? =

Yes. On small screens it switches to a stacked, card-style layout that stays easy to read and use.

= Can guests (non-logged-in users) add products to their cart? =

Yes. Adding to the cart works for both guests and logged-in customers, exactly like standard WooCommerce.

= What happens to my data if I uninstall the plugin? =

Nothing is deleted by default. If you want a clean removal, enable **"Delete all data on uninstall"** in **Simple Product Table → Settings** before removing the plugin.

== Screenshots ==

1. The product table on the storefront, with search, category filter and one-click bulk ordering.
2. Building a table in the admin: pick and rename columns, assign a product list.
3. Creating a reusable product list.
4. The plugin settings page.
5. The responsive, stacked layout on mobile.

== Third-Party Libraries ==

This plugin bundles the following open-source libraries. Both are distributed under the MIT License, which is GPL-compatible.

* **DataTables** (MIT License)
  Homepage: https://datatables.net
  Source: https://github.com/DataTables/DataTables

* **Select2** (MIT License)
  Homepage: https://select2.org
  Source: https://github.com/select2/select2

== Changelog ==

= 1.2.0 =
**Added**

* Quick order: a checkbox on each row and an "Add all to cart" button to add several products to the cart at once (shown when the table has an add-to-cart column).
* Shortcode can now fill a table straight from a product category or tag, for example `[sptable id="42" category="shoes"]` or `[sptable id="42" tag="sale"]`, in addition to the manual product lists.
* New columns: SKU, short description, category and stock status.
* A "Filter by category" dropdown above the table so shoppers can narrow the list to one category.
* A setting to customize the "Add to cart" button label.
* Settings page with an option to delete all tables and lists when the plugin is uninstalled (off by default).
* The product table now switches to a stacked, mobile-friendly layout on small screens.
* A "Shortcode" column on the tables list, with click-to-copy, so the shortcode can be grabbed without opening each table.
* A "How to use" guide on the table editing screen for new users.
* Click-to-copy shortcode in the table editor.
* A "Settings" shortcut on the Plugins screen.
* After activation, the plugin opens the Product Tables screen so you can start right away.

= 1.2.0 =
**Added**

* Quick order: a checkbox on each row and an "Add all to cart" button to add several products to the cart at once (shown when the table has an add-to-cart column).
* Shortcode can now fill a table straight from a product category or tag, for example `[sptable id="42" category="shoes"]` or `[sptable id="42" tag="sale"]`, in addition to the manual product lists.
* New columns: SKU, short description, category and stock status.
* A "Filter by category" dropdown above the table so shoppers can narrow the list to one category.
* A setting to customize the "Add to cart" button label.
* Settings page with an option to delete all tables and lists when the plugin is uninstalled (off by default).
* The product table now switches to a stacked, mobile-friendly layout on small screens.
* A "Shortcode" column on the tables list, with click-to-copy, so the shortcode can be grabbed without opening each table.
* A "How to use" guide on the table editing screen for new users.
* Click-to-copy shortcode in the table editor.
* A "Settings" shortcut on the Plugins screen.
* After activation, the plugin opens the Product Tables screen so you can start right away.

= 1.2.0 =
**Added**

* Quick order: a checkbox on each row and an "Add all to cart" button to add several products to the cart at once (shown when the table has an add-to-cart column).
* Shortcode can now fill a table straight from a product category or tag, for example `[sptable id="42" category="shoes"]` or `[sptable id="42" tag="sale"]`, in addition to the manual product lists.
* New columns: SKU, short description, category and stock status.
* A "Filter by category" dropdown above the table so shoppers can narrow the list to one category.
* A setting to customize the "Add to cart" button label.
* Settings page with an option to delete all tables and lists when the plugin is uninstalled (off by default).
* The product table now switches to a stacked, mobile-friendly layout on small screens.
* A "Shortcode" column on the tables list, with click-to-copy, so the shortcode can be grabbed without opening each table.
* A "How to use" guide on the table editing screen for new users.
* Click-to-copy shortcode in the table editor.
* A "Settings" shortcut on the Plugins screen.
* After activation, the plugin opens the Product Tables screen so you can start right away.

= 1.1.0 =
* Security: added nonce verification to the AJAX add-to-cart handler
* Security: added absint() sanitization for product_id and product_qty in the AJAX handler
* Fix: corrected hardcoded post ID that prevented tables from displaying on any site other than the development environment
* Fix: corrected HTML output for sold-individually products in the quantity column (esc_attr was stripping the hidden input markup)
* Fix: added null check for get_current_screen() in admin script loader to prevent fatal errors on edge-case screens
* Fix: replaced nopaging => true with explicit numberposts limits to prevent unbounded database queries
* Compatibility: updated for WordPress 6.8 and WooCommerce 9.4
* Compatibility: added WooCommerce dependency check with admin notice on activation
* Compatibility: replaced dirname(__FILE__) with __DIR__ throughout
* Code: fixed blank lines before closing braces (PSR-2)
* Code: updated all @link docblock references
* Code: renamed Sptable_i18n to Sptable_I18n to follow PEAR naming conventions

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.1.0 =
Security and compatibility update. Fixes a critical bug that prevented tables from displaying and adds nonce protection to the add-to-cart AJAX action. Upgrade recommended for all users.
