WooCommerce Print Barcodes DocumentationWooCommerce Print Barcodes Documentation
Buy Now
View Demo
  • Getting Started

    • Overview
    • Features
    • Installation
  • Setup & Configuration

    • Admin Configuration
    • Interactive Label Creator
    • Print Server Setup
  • Store Workflows

    • Product Barcodes
    • Order Barcodes & Slips
    • Coupon Barcodes
  • Help & FAQ

    • FAQ & Troubleshooting
Buy Now
View Demo
  • Getting Started

    • Overview
    • Features
    • Installation
  • Setup & Configuration

    • Admin Configuration
    • Interactive Label Creator
    • Print Server Setup
  • Store Workflows

    • Product Barcodes
    • Order Barcodes & Slips
    • Coupon Barcodes
  • Help & FAQ

    • FAQ & Troubleshooting
  • Getting Started

    • Introduction & Overview
    • Features Spotlight
    • Installation Guide
  • Setup & Configuration

    • Admin Configuration
    • Interactive Label Creator
    • Desktop Print Server
  • Store Workflows

    • Product Barcodes Management
    • Order Barcodes & Packing Slips
    • Coupon Barcodes & Vouchers
  • Help & FAQ

    • FAQ & Troubleshooting

Desktop Print Server

The Desktop Print Server is a Node.js daemon that runs locally on cashier or packers' workstations. It receives secure WebSocket print payloads from your WooCommerce web dashboard and routes them directly to default system printers.

This bypasses browser print dialog popups, enabling silent, automated printing.


1. WebSocket Hook Communication

When you click Print in the WooCommerce admin interface:

  1. payload Assembly: auto-print.js reads your visual template properties and wraps data inside a JSON socket payload:
    {
      "action": "print",
      "printer": "Zebra_ZD420",
      "mode": "zpl",
      "content": "^XA^FO50,50^A0N,36,20^FDProduct Name^FS^BY3^FO50,100^BCN,100,Y,N,N^FD12345678^FS^XZ",
      "copies": 2
    }
    
  2. Socket Request: The browser sends this payload via a secure WebSocket connection:
    const socket = new WebSocket("wss://localhost:8080");
    socket.onopen = () => socket.send(JSON.stringify(payload));
    
  3. print daemon routing: The local server processes the incoming payload and forwards the content string (either ZPL instructions or image base64 bytes) to the OS printing stack using native Node library bindings.

2. SSL Certificate Generation & Trust (Critical Step)

Modern browsers enforce secure contexts. HTTPS pages cannot make network calls to HTTP endpoints. Therefore, the local WebSocket server must communicate over SSL (wss://).

To generate and trust the SSL certificates:

Step 1: Run the Cert Generator

Inside your desktop server directory, run:

npm run cert

This generates:

  • certificate/localhost.key (Private key)
  • certificate/localhost.crt (Public certificate)

Step 2: Register Certificate in OS Trust Store

  • Windows:
    1. Double-click localhost.crt.
    2. Click Install Certificate...
    3. Select Local Machine and click Next.
    4. Select Place all certificates in the following store and browse to Trusted Root Certification Authorities.
    5. Click Finish and confirm the security warning.
  • macOS:
    1. Open Keychain Access.
    2. Drag localhost.crt into the System keychain.
    3. Double-click the imported certificate, expand Trust, and change "When using this certificate" to Always Trust.
  • Linux: Copy the cert to /usr/local/share/ca-certificates/ and run:
    sudo update-ca-certificates
    

3. Printing Modes: ZPL vs Image Canvas

Choose your printing mode based on your printer hardware:

ZPL Mode (Zebra Programming Language)

Recommended for Zebra, TSC, Honeywell, and other industrial thermal printers.

  • How it works: The plugin converts HTML/CSS coordinates into standard ZPL vector commands.
  • Benefits:
    • Lightweight payloads (a few bytes compared to megabytes of images).
    • Extremely fast transmission over WebSockets.
    • Razor-sharp, vector-quality barcodes that scan flawlessly.

Image Canvas Mode (Raster)

Recommended for Dymo, Brother, desktop laser, and standard paper printers.

  • How it works: The plugin utilizes html2canvas inside your browser to render the designed label as a high-density canvas image.
  • Process: The canvas is exported as a PNG base64 stream and sent to the local server, which uses standard system drivers to render and print the document.
  • Drawbacks: Larger print payloads and potential blurring of barcode lines if label dimensions are scaled down in printer settings.

[!CAUTION] Firewall Exceptions: If you are setting up the print server on a remote warehouse machine separate from your computer, ensure your workstation firewall allows TCP traffic on port 8080.

Prev
Interactive Label Creator