PrintBase
  • Product
  • Pricing
  • Docs
  • Resources
PrintBase/Guides/Platform printing integrations

How to auto-print WooCommerce order receipts

Print a WooCommerce order receipt from the order-status hook on your server. There is no PrintBase WooCommerce plugin; use the REST API.

For WooCommerce stores printing a counter or office receipt per order

Overview

WooCommerce will email the customer. It will not open a thermal printer in the shop. The reliable hook is on your server: woocommerce_order_status_processing, or _completed if you only print paid orders. PrintBase does not publish a WordPress plugin.

In that PHP hook, build either an ESC/POS receipt or a one-page PDF, then POST /v1/print-jobs. Shared hosting is fine for this because the call is outbound HTTPS. You do not open port 9100 from the host to the shop.

Store printer_code in wp-config or an option, not in the theme. Idempotency-Key wc-receipt-{orderId} absorbs the double firing some gateways cause.

Integration steps

  1. 01

    Put the agent in the shop

    Install it on the computer that has the receipt printer. Confirm the queue name in the OS and the code from GET /v1/printers.

  2. 02

    Hook the status change

    Print from woocommerce_order_status_processing (or your paid status). Do not print from the thank-you page in the browser, where the API key would leak.

  3. 03

    Format the receipt

    ESC/POS raw for a thermal printer, PDF for a desktop printer. Include order number, lines, and total.

  4. 04

    curl the print-jobs endpoint

    Authorization: Bearer, content_type, base64 content, printer_code, and the idempotency key. Check the HTTP status before you log success.

  5. 05

    Record the job id in order meta

    Save the returned id so a failed PRINTER_OFFLINE can be reprinted from wp-admin with a new key.

PHP

<?php
// WooCommerce processing status: ESC/POS receipt
$payload = [
    'printer_code' => (int) getenv('PRINTER_CODE'),
    'content_type' => 'raw',
    'content' => base64_encode($receipt),,
    '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: ' . $idempotencyKey,
    ],
    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

Shared hosting can call the API

The shop printer is reached by the agent, not by the web host. The host only needs outbound HTTPS to api.printbase.cloud. It does not need a raw socket to the printer.

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

Is there a WooCommerce plugin to install?

Not in this product. A few lines in a small custom plugin or a must-use plugin are the integration.

The hook runs twice.

Payment plugins sometimes transition status twice. The same Idempotency-Key returns the original job instead of a second receipt.

Can I print only certain shipping methods?

Yes. That is your if-statement before the HTTP call. The API prints whatever you send.

Guest checkout has no user.

Print from the order id, which exists for guests. You do not need a WordPress user on the printer side.

Related guides

  • 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.

  • How to auto-print WooCommerce shipping labels

    Take the shipping-label PDF your WooCommerce shipping plugin produced and print it through the API. PrintBase does not replace that plugin.

  • Print Laravel receipts from shared hosting

    Laravel on shared hosting can still print. The host only makes HTTPS. The receipt printer stays in the shop behind the agent.

  • Print ESC/POS receipts on an Epson TM-T20III

    Send ESC/POS bytes to a TM-T20III as raw, or a PDF if you rely on the Epson driver. 80 mm paper, code page is your responsibility.

Free plan: 100 jobs a month on one computer, no card.

Create a free accountRead the API docs
PrintBase

PrintBase connects your applications to physical printers anywhere - securely, reliably, and in real time.

Product
Receipt PrintingLabel PrintingDashboardDevicesWebhooks
Resources
DocsBlogStatusAPI ReferenceDownloadPrintBase vs PrintNodePrintNode PricingFAQ
Guides
All guidesIntegrationsPrintersCode samplesComparisonsUse casesTroubleshooting
Company
ContactSecurityPrivacy

© 2026 Aveniq Technologies OÜ. All rights reserved. PrintBase is a service of Aveniq Technologies OÜ.

PrivacyTermsRefunds