How to auto-print WooCommerce kitchen tickets
Send a WooCommerce food order to a kitchen ticket printer as ESC/POS. No plugin is required; fire the print from the order hook.
For Restaurants taking WooCommerce orders for a kitchen printer
Overview
A kitchen ticket is not the customer email. It is items, modifiers, and a table or pickup time, cut on a thermal printer in the pass. WooCommerce does not know which USB printer that is. Your status hook does.
There is no PrintBase WooCommerce plugin. On woocommerce_order_status_processing, build ESC/POS for the 80 mm or 58 mm printer in the kitchen and POST it as content_type raw. If you run more than one station, choose printer_code from the shipping method, a product category, or a meta field — the API will not infer a station.
Use a key like wc-kitchen-{orderId}. A remake is a new key. Do not retry a failed ticket by repeating the same POST without reading the job status first.
Integration steps
- 01
One agent next to the kitchen printer
The computer on the pass runs the agent. The printer must be an OS queue, USB or network, before it appears in GET /v1/printers.
- 02
Map stations to printer codes
Store printer_code per station in your plugin settings. A pizza oven and a bar printer are two codes.
- 03
Lay out modifiers in the bytes
Print item, then indented modifiers, then a note line. Feed before the cut. Encode non-ASCII for the printer's code page.
- 04
POST raw from the status hook
Send base64 ESC/POS with the station's printer_code. Skip the call when the order is not a food order.
- 05
Reprint from the order screen
If status is PRINT_ERROR or PRINTER_OFFLINE, show a reprint button that uses a new Idempotency-Key.
PHP
<?php
// Kitchen ticket for one WooCommerce order
$payload = [
'printer_code' => (int) getenv('PRINTER_CODE'),
'content_type' => 'raw',
'content' => base64_encode($ticket),,
'copies' => 1,
];
$ch = curl_init('https://api.printbase.cloud/v1/print-jobs');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('PRINTBASE_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: ' . 'wc-kitchen-' . $order->get_id(),
],
CURLOPT_POSTFIELDS => json_encode($payload),
]);
$body = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) >= 300) {
throw new RuntimeException($body);
}
$job = json_decode($body, true); // id, status=queued
Details for this setup
Column width
58 mm tickets fit about 32 characters. 80 mm fits about 48. Tabs are not columns. Pad with spaces. The agent writes your bytes unchanged.
How you know it printed
Create returns id and status queued. The job then moves queued, dispatched, printing, completed. Failures use reason codes such as AGENT_OFFLINE, PRINTER_OFFLINE, DOWNLOAD_FAILED, PRINT_ERROR, and INVALID_CONTENT. Poll GET /v1/print-jobs/{id}. Webhooks exist on paid plans only, and only for print_job.completed and print_job.failed.
Questions
Will this print the customer's PDF invoice in the kitchen?
Only if you send that PDF. Kitchens usually want raw ESC/POS so the ticket cuts. Send content_type raw for that.
Can each product category hit a different printer?
Yes. Pick printer_code in your hook. The API targets the code you send; it has no category rules.
Orders from the website at night pile up.
Jobs wait while the agent is offline, and can end as AGENT_OFFLINE. Turn the pass computer on before service, or reprint when it reconnects.
Is there a WordPress plugin from PrintBase?
No. You call the HTTP API from a small plugin you write. Nothing in this product installs itself into WooCommerce.
Free plan: 100 jobs a month on one computer, no card.