=== CatCode B2B Order Import for WooCommerce ===
Contributors: catcodestudio
Tags: woocommerce, b2b, purchase order, wholesale, excel
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

Turn a customer's Excel or CSV purchase order into a WooCommerce order: check the matched lines and create it — no retyping.

== Description ==

Wholesale and B2B customers rarely use the shop's cart. They send a purchase order: an Excel sheet from their accounting system, a CSV, sometimes a PDF. Somebody then re-types every line into a WooCommerce order — looks up each article, types the quantity, double-checks the price. It is slow and every typo ships the wrong goods.

This plugin reads the file and does the matching for you. You only check and correct.

* **Excel .xlsx and CSV / TSV / TXT** — the header row is found automatically, even under a letterhead with the buyer's details; columns are recognised by the usual words in English, Ukrainian, Russian, Polish and German ("SKU", "Item #", "Артикул", "Кількість", "Ilość", "Menge"…). A file without a header is read by the look of its cells.
* **Any encoding and separator** — UTF-8, UTF-16 "Unicode text" and Windows-1251 from Excel; comma, semicolon, tab or pipe; "1 250,50" and "1,250.50" are both understood.
* **Matching with your catalogue** — by SKU (also "AB-100" = "ab 100" = "AB.100"), by barcode (GTIN / EAN / UPC — the WooCommerce field or the common barcode plugins' fields), and by product name with a similarity score. Variations are found by their own SKU.
* **Nothing is ordered on a guess.** A weak name match, a code shared by several products or a variable product without the variation stays unticked until you confirm it. You can pick another product for any line, change quantities, untick lines, and set the columns by hand if a file is unusual.
* **The order in one click** — with the customer's addresses, the purchase order number (found in the file or typed), the customer's own code on each line, and a note. Status of the new order: Pending payment, On hold or Processing.
* **Customer prices** — with CatCode Wholesale Prices active, every line gets the customer's wholesale price for their role and quantity.
* The original file stays attached to the order (private folder, downloadable by managers only); the PO number is searchable in the orders list.
* HPOS (custom order tables) supported.


= What it does not do =

It does not create an order without your confirmation, and it does not send the file anywhere unless you turn on the optional AI recognition and click it. Old binary .xls workbooks are not read — save them as .xlsx or CSV.

== Installation ==

1. Upload the plugin and activate it. WooCommerce must be active.
2. WooCommerce → B2B Order Import: choose the file, optionally the customer, and click "Read the file".
3. Check the lines — the ones that need you are highlighted — and click "Create the order".

== Frequently Asked Questions ==

= The file has its own column names. =

Open "Columns of the file" under the lines, choose which column holds the code, the name and the quantity, and read the file again.

= A line says "variable product — choose the variation". =

The code in the file points at a product with variations. Pick the exact variation in the product field of that line.

= Which price does the order get? =

The shop's price (with CatCode Wholesale Prices — the customer's wholesale price). The price written in the file is shown next to it.

= Where are the files kept? =

In a private folder inside uploads with random names, protected from direct access; managers download them from the import or the order screen. Files of finished imports are deleted after the period set in the settings (180 days by default).

== Changelog ==

= 1.0.0 =
* First release: purchase orders from Excel .xlsx and CSV / TSV / TXT, header and column detection, matching by SKU, barcode and name, review of every line, order with the PO number, customer prices with CatCode Wholesale Prices; English, Ukrainian and Russian.
