=== Multi Warehouse for WooCommerce ===
Contributors: catcodestudio
Tags: woocommerce, warehouse, inventory, multi location, picking list
Requires at least: 6.2
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

Stock per warehouse for every product and variation, automatic order allocation with split lines, availability by warehouse and a picking list.

== Description ==

WooCommerce knows one number per product: how many you have. A shop with a main warehouse, a second city and a shop floor needs to know where those units are, which warehouse an order is picked from, and what the picker has to walk to. Multi Warehouse adds that layer without taking the number away from WooCommerce: the product stock stays the total of all warehouses, so reports, feeds, the storefront and every other plugin keep working as before.

**Stock by warehouse**

* Any number of warehouses, each with a code, address, priority and a switch "ships online orders" (off for a shop floor or a reserve).
* Quantity and shelf location (bin) per warehouse, for simple products, for each variation, and for variable products whose parent manages the stock.
* A stock overview for all products: edit quantities in one table, move units between warehouses (−2 here, +2 there leaves the total as it is), find products whose warehouse total differs from WooCommerce stock and fix them in one click.
* Changes are applied as a difference against what the form showed, so an order placed while someone edits stock keeps its units.

**Orders**

* When WooCommerce takes stock for an order, each line is taken from warehouses by priority; when one warehouse does not have enough, the line is split between warehouses.
* Cancelled orders, refunds with restock, lines edited or deleted by a manager, REST API updates: the allocation always follows the quantity WooCommerce actually took for the line (`_reduced_stock`), and the units go back to the warehouse they came from.
* A "Warehouses" box on the order screen: which warehouse ships which line, shelf locations, shortages (a backorder or a warehouse that ran dry), and moving a line to another warehouse by hand.
* A "Warehouse" column in the orders list.
* Works with HPOS (High-Performance Order Storage) and with the classic posts storage, and with both the block and the classic checkout.

**Picking**

* A printable picking list per order and warehouse, sorted by shelf location (A-2 before A-10), with product images, SKU and GTIN.
* WooCommerce → Warehouses → Orders to pick: orders by status and warehouse, with how many units are picked.

**Storefront**

* "Availability by warehouse" under the add-to-cart button: in stock / only N left / out of stock per warehouse, or exact quantities. Variable products switch with the chosen variation. Classic and block themes; `[catcode_mwh_availability]` shortcode for any other place.

**Correct when orders arrive at the same time**

Every change of a warehouse quantity is one relative SQL statement, and taking the last units is conditional, so two orders cannot take the same unit twice. The warehouse total is kept equal to WooCommerce stock at the end of every request: a stock change made by anything else (an import, the REST API, an ERP sync, quick edit, a plugin that shares stock between products) lands in the main warehouse: an increase is added to it, a decrease is taken from it while it has stock and then from the other warehouses by priority. One order's stock is reduced by one request at a time, so a payment callback and the customer's return page arriving together do not take the stock twice.


**Where the data goes**

Nowhere. Warehouses, quantities and allocations are stored in three tables in your WordPress database. No external requests.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active, with stock management on.
2. WooCommerce → Warehouses: the main warehouse is already there with all your current stock. Add the other warehouses and their priorities.
3. Distribute stock: in the product editor (Inventory tab, and each variation), or for many products at once in Warehouses → Stock by warehouse.

== Frequently Asked Questions ==

= What happens to my current stock? =

Nothing changes in WooCommerce. All of it is counted in the main warehouse until you move units to other warehouses.

= Another plugin or an import updates my stock. =

WooCommerce's stock is still updated as before; an increase is added to the main warehouse, a decrease is taken from the main warehouse while it has stock and then from the other warehouses by priority, so the warehouse total always matches and no warehouse keeps units the product no longer has.

= Which warehouse does an order take stock from? =

From the warehouses marked "Ships online orders", lowest priority number first. A line that one warehouse cannot cover is split. You can move any line to another warehouse on the order screen.

= Can a warehouse go below zero? =

Yes, when you sell on backorder: the shortage is shown on the order screen and in the stock overview.

= Does it support variable products? =

Yes: variations with their own stock get their own quantities per warehouse; variations using the parent's stock share the parent's.

= What if I delete a warehouse? =

Its stock moves to the main warehouse; product totals do not change. The main warehouse cannot be deleted.

== Changelog ==

= 1.0.0 =
* First release: warehouses, stock and shelves per warehouse, allocation by priority with split lines, restore on cancel / refund / edit, order screen box, stock overview, picking list, availability on the product page, HPOS and block checkout support.
