=== WholeStock – Wholesale, Inventory & Warehouse Stock Management ===
Contributors: wpfinity
Tags: wholesale, inventory management, stock management, warehouse, invoice
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 8.0
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Wholesale inventory and warehouse stock management for WordPress. Track shipments, batch stock, customers, sales orders, payments, dues and invoices.

== Description ==

**WholeStock** is a wholesale inventory management and warehouse stock management system that runs inside your WordPress admin. It is built for wholesalers, importers, distributors and trading businesses that buy stock in shipments and sell it on to retailers and B2B customers.

Instead of juggling spreadsheets, WholeStock tracks every product from the moment a shipment lands in your warehouse to the moment the goods are delivered and paid for. You always know what is in stock, which batch it came from, who owes you money and how much profit each batch made.

WholeStock works on its own. It does **not** need WooCommerce, an online store or any third-party service, and all of your data stays in your own WordPress database.

[Get WholeStock Pro](https://wpfinity.com/products/wholestock/) | [Plugin home page](https://wpfinity.com/products/wholestock/)

= Who is WholeStock for? =

* Wholesale businesses and B2B distributors
* Import and export businesses that receive goods in containers or shipments
* Warehouse and godown managers who need batch-level stock control
* Trading companies selling in cartons, boxes, dozens and pieces
* Small businesses that have outgrown inventory spreadsheets

= Why WholeStock? =

* **Batch-level stock tracking** – Every unit is tied to the shipment it arrived in, so you get full traceability and a true cost per batch.
* **Multi-unit inventory** – Buy in cartons, sell in dozens or pieces. WholeStock converts between units automatically.
* **Customer dues tracking** – See unpaid, partially paid and paid orders at a glance, plus each customer's lifetime balance.
* **Profit per batch** – Landed cost, revenue and profit/loss for every shipment item.
* **Fast, modern interface** – A single-page app inside wp-admin, built on the WordPress REST API.

= Free Features =

**Inventory & Stock Management**

* **Product catalog** – Products with SKUs, a base unit and unlimited custom unit conversions (for example 1 carton = 12 boxes = 144 pieces).
* **Real-time stock view** – Received, sold and remaining quantity for every shipment item, with batch traceability and search.
* **Dead stock badge** – Batches older than 60 days with stock still left are flagged so you can clear slow-moving inventory.
* **Stock watchlist** – The dashboard highlights the batches with the lowest remaining stock.
* **Overselling protection** – Orders are validated against the remaining batch stock, and stock from cancelled orders is released automatically.

**Shipments & Purchasing (Inbound)**

* **Shipment tracking** – Record incoming shipments with line items, carton counts and per-unit cost in any unit.
* **Landed cost** – Add a shipment's total extra costs (freight, customs, duty, handling) and they are included in the landed unit cost of each item.
* **Batch profit & loss** – Cost, revenue and P/L for every batch, visible to administrators only.

**Sales Orders, Customers & Payments (Outbound)**

* **Wholesale sales orders** – Create orders from specific shipment batches, with an order workflow: pending → confirmed → delivered (or cancelled).
* **Customer management** – Customer profiles with contact details, order history and lifetime due tracking.
* **Payment tracking** – Record full or partial payments against any order. Payment status (unpaid, partial, paid) updates automatically.
* **Accounts receivable** – Know exactly how much each customer owes you.

**Invoices & Documents**

* **Professional invoices** – Printable invoices with your business name, logo and footer text.
* **Shareable invoice links** – Public or private invoice URLs to send to customers, with print and PDF download support.

**Business Tools**

* **Dashboard** – KPIs, recent shipments, recent orders, stock watchlist and quick actions.
* **Setup wizard** – Get your business details, currency and number prefixes ready in a couple of minutes.
* **Multi-currency formatting** – 40+ world currencies with custom symbol position, separators and decimal places.
* **Custom number prefixes** – Your own prefixes for order and shipment numbers.
* **Audit log** – Every create, update and delete is logged with the user, time and before/after values, with configurable retention.
* **Staff roles** – Administrators manage products, shipments and settings. Staff with Editor-level access can manage customers, orders, payments and stock without seeing cost and profit figures.

= WholeStock Pro Features =

[WholeStock Pro](https://wpfinity.com/products/wholestock/) is an add-on for growing wholesale and warehouse operations. It needs the free WholeStock plugin and adds:

* **Revenue & profit analytics** – Interactive charts for revenue, profit margins and cash flow over 30 days, 90 days or a year, plus collected cash vs. outstanding receivables.
* **CSV / Excel exports** – One-click exports of stock, orders, customers and shipments that follow your current filters.
* **Advanced landed cost** – Itemize shipment costs (sea freight, customs duty, insurance, and more) and choose how they are allocated across line items.
* **Order discounts** – Give a customer a percentage or fixed-amount discount with a reason. Discounts flow through to totals, invoices, dues, revenue and batch profit.
* **Warehouse picking lists** – Print picking lists without prices, broken down by carton and batch, for your warehouse team.
* **Delivery challans / gate passes** – Printable delivery notes for drivers and transport, as proof of delivery.
* **Customer ledger statements** – Printable account statements for any date range, with opening balance and running balance.
* **Priority support and updates** from the Wpfinity team.

**[Upgrade to WholeStock Pro →](https://wpfinity.com/products/wholestock/)**

= Free vs Pro =

* Products, multi-unit conversions, shipments, batch stock – **Free**
* Sales orders, customers, payments, due tracking – **Free**
* Invoices (print / PDF / shareable link) – **Free**
* Total landed cost and batch profit & loss – **Free**
* Audit log, setup wizard, multi-currency – **Free**
* Revenue, margin and cash flow analytics charts – **Pro**
* CSV / Excel exports – **Pro**
* Itemized landed cost with allocation methods – **Pro**
* Order discounts – **Pro**
* Picking lists, delivery challans, customer ledgers – **Pro**

= Privacy =

WholeStock does not track you, does not phone home and does not send your data to any external service. All products, stock, customers and orders are stored in custom tables in your own WordPress database.

== Installation ==

= Automatic installation =

1. In your WordPress admin, go to **Plugins → Add New**.
2. Search for **WholeStock**.
3. Click **Install Now**, then **Activate**.
4. Open the **WholeStock** menu and follow the setup wizard.

= Manual installation =

1. Download the plugin zip file.
2. Upload the `wholestock` folder to the `/wp-content/plugins/` directory, or upload the zip from **Plugins → Add New → Upload Plugin**.
3. Activate the plugin through the **Plugins** menu in WordPress.
4. Open the **WholeStock** menu and follow the setup wizard to add your business details and currency.

= Getting started =

1. Add your **products** and their unit conversions.
2. Record a **shipment** to bring stock into your warehouse.
3. Add your **customers**.
4. Create a **sales order** from the available batch stock.
5. Record **payments** and share the **invoice** with your customer.

== Frequently Asked Questions ==

= Is WholeStock free? =

Yes. The core plugin is free and includes products, shipments, batch stock tracking, customers, sales orders, payments, invoices and audit logs. [WholeStock Pro](https://wpfinity.com/products/wholestock/) adds analytics, CSV exports, discounts, advanced landed cost and printable warehouse documents.

= Do I need WooCommerce? =

No. WholeStock is a standalone wholesale inventory and warehouse management system. It does not need WooCommerce or any online store.

= Can I manage stock in cartons, boxes and pieces? =

Yes. Each product has a base unit and any number of custom units (for example 1 carton = 24 pieces, 1 dozen = 12 pieces). You can receive stock in one unit and sell it in another, and WholeStock converts automatically.

= How does batch (shipment-level) stock tracking work? =

Every shipment line becomes a stock batch. When you create a sales order, you choose which batch to sell from. This gives you full traceability, accurate cost per batch and profit/loss per shipment.

= Can I track customer dues and partial payments? =

Yes. Record any number of payments against an order. WholeStock updates the payment status (unpaid, partial or paid) and keeps a running due balance for every customer.

= Can I send invoices to customers? =

Yes. Every order has a printable invoice that can be downloaded as PDF. You can make invoice links public so customers can open them without logging in, or keep them private.

= Can my warehouse staff use it without seeing my profit margins? =

Yes. Staff with Editor-level access can manage customers, orders, payments and stock, while cost, landed cost and profit figures are only visible to administrators.

= Does it support my currency? =

WholeStock includes 40+ world currencies and lets you set the symbol position, thousand separator, decimal separator and decimal places.

= Where is my data stored? =

In custom database tables in your own WordPress site. Nothing is sent to external servers.

= What is included in WholeStock Pro? =

Revenue, margin and cash flow analytics, CSV exports, itemized landed cost allocation, order discounts, warehouse picking lists, delivery challans and customer ledger statements. [See WholeStock Pro](https://wpfinity.com/products/wholestock/).

= What are the requirements? =

WordPress 6.2 or higher and PHP 8.0 or higher.

== Screenshots ==

1. Dashboard overview with business KPIs, live charts, and stock watchlist.
2. Product catalog list with SKU codes, unit conversions, and stock levels.
3. Product creation form with custom multi-unit packaging conversion rules.
4. Inbound shipment list with supplier details, landed costs, and statuses.
5. Incoming shipment form with line items, carton counts, and landed costs.
6. Wholesale customer directory with contact details, orders, and balances.
7. Customer creation form with contact details, company address, and notes.
8. Wholesale sales orders list with fulfillment statuses and customer dues.
9. Wholesale sales order form with batch stock allocation and unit pricing.
10. Printable customer invoice layout with payment breakdown and PDF export.
11. Print invoice preview dialog configured for standard paper and receipts.
12. Real-time warehouse stock view with batch traceability and aging alerts.
13. Comprehensive audit log tracking all system actions, users, and changes.
14. Currency configuration with 40+ world currencies, symbols, and decimals.
15. Business profile settings with company logo, address, and invoice notes.

== Changelog ==

= 1.1.0 - 2026-10-10 =
* New: Landed cost – a shipment's extra costs (freight, customs, duty) are now allocated across its line items and included in each batch's landed unit cost and profit/loss.
* New: Shipments list shows extra costs, the allocation method and the landed cost per unit.
* New: Order discount support in totals, invoices, customer dues, revenue and batch profit/loss (discount entry available in WholeStock Pro).
* New: Invoices show the discount line when an order has a discount.
* New: Dashboard analytics charts are now driven by live data with 30-day, 90-day and yearly ranges (WholeStock Pro).
* New: CSV export buttons on Stock, Orders, Customers and Shipments that follow the current filters (WholeStock Pro).
* New: Picking list, delivery challan and customer ledger buttons on order and customer pages (WholeStock Pro).
* New: Pro & License tab in Settings.
* Improvement: Database tables are upgraded automatically after a plugin update.
* Improvement: Updated plugin description and documentation.

= 1.0.1 - 2026-10-07 =
* Fix: Ensure stock from cancelled orders is properly released and excluded when calculating remaining batch stock during order creation.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.0 =
Adds landed cost allocation, order discount support and live dashboard analytics. Database tables are updated automatically.

= 1.0.1 =
Fixes remaining batch stock calculation for cancelled orders. Recommended update.
