=== GP B2B Orders for WooCommerce ===
Contributors: goalprevail
Tags: woocommerce, b2b, orders, wholesale, stock
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds professional B2B order statuses to WooCommerce with automatic stock control and an admin email notification.

== Description ==

**GP B2B Orders for WooCommerce** makes it easy to manage business-to-business sales. It adds clear, functional order statuses built for wholesale and B2B workflows while staying fully compatible with WooCommerce core (including HPOS / Custom Order Tables).

= Custom statuses =
* **B2B Shipped, Unpaid** &mdash; reduces stock once when set, order stays editable.
* **B2B Unshipped, Unpaid** &mdash; no stock change, order stays editable.
* **B2B Shipped, Paid (Completed)** &mdash; behaves like Completed, treated as paid, not editable, stock reduced once if not already.

Each status behaves like a native WooCommerce status:

* Appears in reports, filters, and bulk actions
* Counts in WooCommerce analytics
* Available through the WooCommerce REST API
* Never reduces stock twice for the same order

An optional **admin email notification** is sent when an order moves into a B2B status. It uses standard WooCommerce email styling and includes product thumbnails and a direct link to edit the order.

== Features ==

* Three custom B2B order statuses
* Automatic stock handling on status change (idempotent)
* Bulk actions for quick status updates (works with both the legacy and HPOS orders screens)
* Optional admin email notification for B2B status changes
* Settings tab under **WooCommerce &rarr; Settings &rarr; B2B Orders**
* Email configuration under **WooCommerce &rarr; Settings &rarr; Emails**
* Compatible with WooCommerce reports, analytics, and REST API
* HPOS / Custom Order Tables compatible

== Installation ==

1. Upload the `gp-b2b-orders-for-woocommerce` folder to `/wp-content/plugins/`, or install through **Plugins &rarr; Add New**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Go to **WooCommerce &rarr; Settings &rarr; B2B Orders** to choose which B2B statuses are available.
4. Go to **WooCommerce &rarr; Settings &rarr; Emails &rarr; B2B Order Status Update** to enable the notification and set the recipient.

== Frequently Asked Questions ==

= Does this plugin modify core WooCommerce behavior? =
No. It only registers new order statuses and hooks into standard WooCommerce filters and actions.

= Who receives the B2B order email? =
By default, the site admin email. You can change the recipient(s) under **WooCommerce &rarr; Settings &rarr; Emails &rarr; B2B Order Status Update**.

= Will it reduce stock more than once for the same order? =
No. The plugin tracks reduction per-order with order meta to ensure stock is adjusted only once.

= Is it compatible with High-Performance Order Storage (HPOS)? =
Yes. The plugin declares HPOS compatibility and registers bulk actions for the HPOS orders screen.

== Changelog ==

= 1.0.0 =
* Initial release.
* Three custom B2B order statuses with optional toggles.
* Automatic, idempotent stock handling.
* Bulk actions on legacy and HPOS orders screens.
* Admin email notification for B2B status changes.
* WooCommerce reports, analytics, and REST API integration.
* HPOS / Custom Order Tables compatibility declared.

== Upgrade Notice ==

= 1.0.0 =
First public release.
