Quick order: when the buyer already knows the item numbers

A regular buyer is not browsing. She has a list of item numbers and quantities and wants it in the basket within a minute. Here are the four ways B2B shops solve that, what the platforms include, and a script we ran ourselves against WooCommerce.

Last checked:

Step by stepFour patterns you meet everywhere
  1. SKU entry
  2. File upload
  3. Reorder
  4. Variation grid

Four patterns you meet everywhere

  1. SKU entry. A table where the buyer types item number and quantity line by line. Shopify calls it a quick order list and includes it on every B2B plan.
  2. File upload. The buyer uploads a CSV or Excel file of item numbers and quantities. Shoporama and Shopware Evolve both describe this.
  3. Reorder. “Same as last time” from the order history. Shopify has easy reorders on every B2B plan.
  4. Variation grid. Size × quantity in one table. That is what we are building into our own plugin Lynbro Variation Swatches – in development, with 42 of 42 end-to-end tests passing in Danish, English and Ukrainian.

There is a fifth pattern too: no basket at all. For printed or made-to-measure goods a request button often beats a cart. A Danish competitor of the workwear shop we maintain uses a three-field calculator and a «Send forespørgsel» (send request) button instead of a basket. Our own furniture-assembly site uses WooCommerce the same way: 5,937 product pages without checkout, each with a form.

What WooCommerce plugins give you

WooCommerce has no quick order of its own. Wholesale Suite includes an order form in its $299-a-year bundle. B2BKing lists an order form among its features, but the pricing page does not tie it to a licence tier. Stand-alone plugins exist as well, such as Bulk Order Form for WooCommerce with 800+ installs. We have not run any of them in production.

When the buyer e-mails a spreadsheet

Plenty of B2B orders still arrive as a file attached to an e-mail. The owner of the workwear shop works in Excel himself. So we wrote a small script for the seller: it reads the buyer’s sheet, checks every line against the shop and creates the order on account. It is not a customer-facing feature; it is a tool for whoever types those orders in today.

The script does five things:

  • Reads Danish Excel: semicolons, BOM and “10,00” as a quantity. The same item number twice becomes one line.
  • Looks up all item numbers in one call. The WooCommerce REST API accepts a comma-separated list, matches exact SKUs only and returns variations with their parent.
  • Stops on bad lines: unknown item number, no price (not the same as sold out), sold out, below the minimum and wrong increment.
  • Uses the price from your price list when the sheet has a “nettopris” (net price) column. Without it, the order gets the shop’s normal price – even if the customer has a group price in a plugin.
  • Never creates the same order twice. Customer + PO reference + lines give a key stored on the order; the next run with the same sheet stops. Same idea as the idempotency key in the MobilePay API.

csv_to_order.py – buyer’s spreadsheet → WooCommerce order on account

#!/usr/bin/env python3
"""CSV order sheet -> WooCommerce order on account (dry run unless --commit).

CSV: varenummer;antal[;nettopris] (Danish Excel: ';', BOM, decimal comma). nettopris comes from YOUR
price list export, never from the buyer. Env: WC_URL, WC_USER, WC_SECRET
(consumer key/secret or an application password; HTTPS only in production).
"""
import argparse, base64, csv, hashlib, io, json, os, re, sys, urllib.error, urllib.parse, urllib.request

def api(method, path, body=None, **query):
    url = os.environ["WC_URL"].rstrip("/") + "/wp-json/wc/v3/" + path
    if query:
        url += "?" + urllib.parse.urlencode(query)
    token = base64.b64encode(f'{os.environ["WC_USER"]}:{os.environ["WC_SECRET"]}'.encode()).decode()
    req = urllib.request.Request(url, method=method, data=json.dumps(body).encode() if body else None,
                                 headers={"Authorization": "Basic " + token, "Content-Type": "application/json"})
    try:
        with urllib.request.urlopen(req, timeout=30) as r:
            return json.load(r)
    except urllib.error.HTTPError as e:                      # show WooCommerce's own reason
        sys.exit(f"{method} {path}: HTTP {e.code} {e.read().decode()[:300]}")

def read_sheet(raw):
    text = raw.decode("utf-8-sig")
    dialect = csv.Sniffer().sniff(text.splitlines()[0], delimiters=";,\t")
    lines, prices = {}, {}
    for row in csv.DictReader(io.StringIO(text), dialect=dialect):
        row = {k.strip().lower(): (v or "").strip() for k, v in row.items() if k}
        sku = row.get("varenummer") or row.get("sku") or ""
        qty = re.sub(r",0+$", "", row.get("antal") or row.get("qty") or "")   # Excel: 10,00
        if not sku:
            continue
        if not qty.isdigit() or int(qty) == 0:
            sys.exit(f"Line with {sku}: quantity '{qty}' is not a whole number")
        lines[sku] = lines.get(sku, 0) + int(qty)          # same SKU twice = one line
        if row.get("nettopris"):
            price = row["nettopris"]
            if "," in price:                                   # 1.234,50 -> 1234.50
                price = price.replace(".", "").replace(",", ".")
            if prices.setdefault(sku, price) != price:
                sys.exit(f"{sku}: two different prices in the sheet")
    return lines, prices

def gln_ok(ean):
    if len(ean) != 13 or not ean.isdigit():
        return False
    s = sum(int(d) * (3 if i % 2 else 1) for i, d in enumerate(ean[:12]))
    return (10 - s % 10) % 10 == int(ean[12])

def meta(item, key):
    return next((int(m["value"]) for m in item.get("meta_data", []) if m["key"] == key), None)

def check(lines, prices):
    found, skus = {}, list(lines)
    for i in range(0, len(skus), 50):
        for p in api("GET", "products", sku=",".join(skus[i:i + 50]), per_page=100):
            found[p["sku"]] = p                                # exact SKU only
    parents = {p["parent_id"] for p in found.values() if p["type"] == "variation"}
    parent = {p["id"]: p for p in api("GET", "products", include=",".join(map(str, parents)))} if parents else {}
    ok, errors = [], []
    for sku, qty in lines.items():
        p = found.get(sku)
        if not p:
            errors.append(f"{sku}: unknown item number"); continue
        if p["price"] == "":
            errors.append(f"{sku}: has no price (not the same as sold out)"); continue
        if p["status"] != "publish" or p["stock_status"] == "outofstock" or not p["purchasable"]:
            errors.append(f"{sku}: cannot be ordered ({p['stock_status']})"); continue
        rules = parent.get(p.get("parent_id"), {})
        low = meta(p, "min_qty") or meta(rules, "min_qty") or 1
        step = meta(p, "qty_step") or meta(rules, "qty_step") or 1
        if qty < low or qty % step:
            errors.append(f"{sku}: {qty} pcs - minimum {low}, in steps of {step}"); continue
        line = {"quantity": qty}
        price = prices.get(sku, p["price"])                    # the REST user's price, not the customer's
        if sku in prices:
            line["subtotal"] = line["total"] = f"{float(price) * qty:.2f}"
        if p["type"] == "variation":
            line.update(product_id=p["parent_id"], variation_id=p["id"])
        else:
            line["product_id"] = p["id"]
        ok.append((sku, p["name"], qty, price, line))
    return ok, errors

def main():
    a = argparse.ArgumentParser()
    a.add_argument("sheet"); a.add_argument("--customer", type=int, required=True)
    a.add_argument("--po", required=True, help="the buyer's order reference")
    a.add_argument("--ean", default=""); a.add_argument("--commit", action="store_true")
    args = a.parse_args()
    if args.ean and not gln_ok(args.ean):
        sys.exit(f"EAN {args.ean} fails the check digit")
    raw = open(args.sheet, "rb").read()
    lines, prices = read_sheet(raw)
    ok, errors = check(lines, prices)
    for sku, name, qty, price, _ in ok:
        print(f"OK   {sku:<12} {qty:>5} x {price:>8}  {name}")
    for e in errors:
        print("STOP", e)
    if errors or not ok:
        sys.exit(1)
    key = hashlib.sha256(f"{args.customer}|{args.po}|{sorted(lines.items())}".encode()).hexdigest()[:16]
    for o in api("GET", "orders", customer=args.customer, per_page=50):
        if meta_value(o, "_b2b_import_key") == key:
            sys.exit(f"Already created as order {o['id']} - nothing sent")
    if not args.commit:
        print("Dry run: add --commit to create the order"); return
    c = api("GET", f"customers/{args.customer}")
    billing = {k: v for k, v in c["billing"].items() if v}    # an empty e-mail field gives HTTP 400
    billing.setdefault("email", c["email"])
    order = api("POST", "orders", {
        "customer_id": args.customer, "status": "on-hold", "set_paid": False,
        "payment_method": "b2b_invoice", "payment_method_title": "Faktura",
        "billing": billing, "shipping": {k: v for k, v in c["shipping"].items() if v},
        "line_items": [line for *_, line in ok],
        "meta_data": [{"key": "_b2b_import_key", "value": key}, {"key": "_b2b_po", "value": args.po},
                      {"key": "_b2b_ean", "value": args.ean}]})
    back = api("GET", f"orders/{order['id']}")                 # read it back, do not trust the 201
    assert sum(i["quantity"] for i in back["line_items"]) == sum(lines.values()), "quantities differ"
    print(f"Order {back['id']}: {back['total']} {back['currency']} incl. {back['total_tax']} moms")

def meta_value(obj, key):
    return next((m["value"] for m in obj.get("meta_data", []) if m["key"] == key), None)

if __name__ == "__main__":
    main()

How we tested it

On 3 December 2026 we set up a clean test install with WooCommerce 11.3.1, Danish 25 % VAT, items with and without a price, a sold-out item, a T-shirt in two sizes and one business customer. The test gave four results we could not have read anywhere:

  • The dry run stopped on six kinds of error in one sheet, and a partial item number like “JAK” was not matched.
  • The first real order failed with HTTP 400 “Invalid email address”, because the customer’s billing e-mail was empty. The script now sends only filled-in fields and falls back to the account e-mail.
  • The group price did not carry over. With B2BKing installed the customer saw 299 DKK, but the API order got 399 DKK. With a net price in the sheet the lines became 4,485 + 1,590 + 177 DKK, and WooCommerce added 25 % VAT itself: 7,815 DKK in total.
  • A second run with the same sheet was refused with “Already created as order 17”.

The test install has been deleted. On the shop we maintain we test the order flow end to end: the Store API puts an item in the basket and places a real order, the confirmation e-mail is read over IMAP, the order is deleted and the order count is compared before and after. During the test the owner’s own new-order e-mail is redirected, so he is not told about a sale that does not exist.

Run it yourself

  1. Create a REST key in WooCommerce with read/write access and set WC_URL, WC_USER and WC_SECRET in the environment. HTTPS only.
  2. Run without --commit first. The script lists every line and stops on errors.
  3. Run with --commit. The order is created “on-hold” with the payment method “Faktura” (invoice) and read back before the script reports success.

Minimum and increment are read from the item metadata min_qty and qty_step. If your plugin uses other fields, change two lines. The duplicate check only looks at the customer’s 50 most recent orders.

Sources

Last reviewed: 2026-12-04

Questions about quick order

Can buyers upload a spreadsheet in WooCommerce themselves?

Yes, with a plugin that has an order form or file upload; WooCommerce core does not. The script on this page is for the seller, not the buyer.

Does the order get the customer’s agreed price?

Not automatically when it is created through the API – in our test it got the normal price. Use the net price column from your own price list, never a price the buyer typed.

What about variations?

The script finds variations by their own item number and adds them under the right parent product.

Could it run automatically from an inbox?

It could, but let a person approve the dry run first. A run that reports “success” is not the same as a correct order – we learned that from automations that reported success without sending anything.

Fixed price, no commitment

Free B2B check and a fixed price

Tell us briefly what you use today and what you want to achieve. A person answers by e-mail with a proposal and a fixed price before any work starts.

  • A fixed price before we start
  • An answer by e-mail, no calls
  • Your details are used only to answer you

Fields marked with * are required.

What is it about?