---
title: "WooCommerce plugin hooks and filters for BizPrint"
description: "Use the public WordPress actions and filters of the BizPrint plugin for WooCommerce to add content to printouts and adjust which printer locations print an order."
url: https://docs.getbizprint.com/developers/woocommerce-hooks/
section: "Developers"
last_updated: 2026-11-12
---

# WooCommerce plugin hooks and filters for BizPrint

Section: Developers

> Use the public WordPress actions and filters of the BizPrint plugin for WooCommerce to add content to printouts and adjust which printer locations print an order.

This page lists the public WordPress actions and filters of the [BizPrint plugin for WooCommerce](https://docs.getbizprint.com/start-here/glossary/#bizprint-plugin-for-woocommerce), with short examples. It is for developers and agencies who customize printouts or printing for a WooCommerce store. It does not apply to Shopify or to the Print API.

Add your code to your own plugin or a site-specific plugin, never to the BizPrint plugin’s files, so updates do not remove it.

## Before you start

- Hooks that change printouts run when the plugin prepares an order for printing. They affect the next print. A reprint from the [BizPrint dashboard](https://docs.getbizprint.com/start-here/glossary/#bizprint-dashboard) also prints the current order with your current code.
- Hooks that change which [printer locations](https://docs.getbizprint.com/start-here/glossary/#printer-location) print an order can make an order print in fewer or more places. Test them on a staging copy of your store first.
- Never create or repeat a print from a hook to “make sure” an order prints. That causes duplicate printouts. If an order did not print, follow [If an order did not print](https://docs.getbizprint.com/developers/woocommerce-hooks/#if-an-order-did-not-print) on this page.

## Plugin loaded

| Hook            | Type   | When it runs                                                                                                                                         |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `zprint_loaded` | action | After the BizPrint plugin has loaded. Register [templates](https://docs.getbizprint.com/start-here/glossary/#template) and other BizPrint code here. |

## Add content to the classic templates

The three classic templates have their own actions. The hook name is built from the template, the [output format](https://docs.getbizprint.com/start-here/glossary/#output-format) and a position:

`Zprint\templates\{template}-{format}\{position}`

- `{template}`: `customer` (**Customer Receipt**), `details` (**Customer Order Receipt**) or `order` (**Order Receipt**).
- `{format}`: `html` or `plain`.
- `{position}`: `beforeCustomerDetails`, `afterBaseCustomerDetails`, `afterCustomerDetails` or `afterShippingDetails`. **Customer Receipt** and **Customer Order Receipt** also have `beforeFooter`. **Order Receipt** also has `end`.

Each action passes the order ID and the `WC_Order` object. One exception: `Zprint\templates\order-plain\afterShippingDetails` passes only the order ID. Anything your callback prints (with `echo`) appears on the printout at that position.

This example prints an allergy note, saved on the order by your own checkout code as the `_acme_allergies` meta field, on the HTML **Order Receipt**, which many stores use as a kitchen ticket:

```php
add_action( 'Zprint\templates\order-html\afterCustomerDetails', function ( $order_id, $order ) {
  $allergies = $order->get_meta( '_acme_allergies' );

  if ( $allergies ) {
    echo '<p><strong>Allergies:</strong> ' . esc_html( $allergies ) . '</p>';
  }
}, 10, 2 );
```

For a plain text template, print with the plugin’s `Zprint\Document` helpers instead of HTML, so the text fits the [printer](https://docs.getbizprint.com/start-here/glossary/#printer)’s width:

```php
add_action( 'Zprint\templates\order-plain\end', function ( $order_id, $order ) {
  $allergies = $order->get_meta( '_acme_allergies' );

  if ( $allergies ) {
    echo \Zprint\Document::emptyLine();
    echo \Zprint\Document::line( 'Allergies: ' . $allergies );
  }
}, 10, 2 );
```

Remember that a printer location uses either HTML or plain text. If a location might use both, hook both versions.

## Add content to the other built-in templates

The other seven built-in templates (**Address Labels**, **Delivery Note**, **Dispatch Label**, **Invoice**, **Packing Slip**, **Pick List** and **Shipping Label**) share one set of actions:

`Zprint\templates\advanced\{position}`

Each passes the `WC_Order` object and an array with the printer location’s settings (`$location_data`). Not every template has every position. The positions are:

- `beforeAll`, `afterAll`, `beforeDetails`, `afterDetails`, `afterProducts`
- `beforeShopInfo`, `afterShopInfo`, `beforeCompanyInfo`, `afterCompanyInfo`
- `beforeOrderInfo`, `afterOrderInfo`, `beforeBillingInfo`, `afterBillingInfo`
- `beforeShippingInfo`, `afterShippingInfo`, `beforeCustomerDetails`, `afterCustomerDetails`

On **Address Labels**, the address position depends on the address type chosen for the location: `beforeShopInfo`, `beforeShippingInfo`, `beforeBillingInfo` or `beforeReturnInfo` (and the matching `after` names).

Because these actions are shared, check `$location_data['template']` and `$location_data['format']` to target one template and format. The template values are `address-labels`, `delivery-note`, `dispatch-label`, `invoice`, `packing-slip`, `pick-list` and `shipping-label`.

```php
add_action( 'Zprint\templates\advanced\afterProducts', function ( $order, $location_data ) {
  if ( 'packing-slip' !== $location_data['template'] || 'html' !== $location_data['format'] ) {
    return;
  }

  echo '<p>Thank you for shopping with us.</p>';
}, 10, 2 );
```

## Change what is printed for each item

These filters change the extra details printed under each order item (the item meta, such as size or options).

| Filter                                                  | Arguments                               | What it does                                                                                                          |
| ------------------------------------------------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `Zprint\templates\{template}-{format}\orderItemRawMeta` | meta array, `WC_Order_Item`, `WC_Order` | The item’s meta before hidden keys are removed. Classic templates only.                                               |
| `Zprint\templates\{template}-{format}\orderItemMeta`    | meta array                              | The item’s meta that will be printed. Classic templates only.                                                         |
| `Zprint\templates\advanced\orderItemRawMeta`            | meta array, `WC_Order_Item`, `WC_Order` | Same as the raw filter, for the other built-in templates.                                                             |
| `Zprint\templates\advanced\orderItemMeta`               | meta array                              | Same as the meta filter, for the other built-in templates.                                                            |
| `woocommerce_hidden_order_itemmeta`                     | array of meta keys                      | The WooCommerce filter for hidden item meta. The BizPrint plugin also uses it, so keys you hide here are not printed. |

Each meta entry is an object with `key` and `value` properties, as returned by WooCommerce’s `get_formatted_meta_data()`.

This example stops a meta entry called “Gift wrap” from printing on the HTML **Customer Receipt**:

```php
add_filter( 'Zprint\templates\customer-html\orderItemMeta', function ( $meta ) {
  return array_filter( $meta, function ( $entry ) {
    return 'Gift wrap' !== $entry->key;
  } );
} );
```

## Change the printed order number

`Zprint\templates\general\orderIdLabel` filters the order number on every built-in template that prints one. It receives the order ID and the `WC_Order` object. By default the plugin prints the order ID. If your store uses a plugin for custom or sequential order numbers, print that number instead:

```php
add_filter( 'Zprint\templates\general\orderIdLabel', function ( $label, $order ) {
  return $order->get_order_number();
}, 10, 2 );
```

## Templates

| Hook                     | Type   | Arguments                          | What it does                                                                                                    |
| ------------------------ | ------ | ---------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `Zprint\getTemplates`    | filter | array of templates                 | The list of available templates. Use `Zprint\Templates::registerTemplate()` rather than this filter to add one. |
| `Zprint\getTemplatePath` | filter | file path, template object, format | The template file used for a template and format. Return your own file path to replace the file of a template.  |

For a complete custom template, see [Build a custom WooCommerce template for BizPrint](https://docs.getbizprint.com/developers/custom-templates/).

## Printing an order

| Hook                          | Type   | Arguments                                                                | When it runs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------- | ------ | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Zprint\printOrder`           | action | order (`WC_Order` or ID), print arguments                                | Before the plugin sends an order to its printer locations, for automatic and manual prints.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `Zprint\filterLocations`      | filter | array of locations, `WC_Order`, array of all locations, location filters | After the plugin has chosen which printer locations print this order. Return fewer locations to skip some.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `Zprint\printJobStatusUpdate` | action | job object                                                               | When BizPrint tells your store, with a [webhook](https://docs.getbizprint.com/start-here/glossary/#webhook), that a [print job status](https://docs.getbizprint.com/start-here/glossary/#print-job-status) changed. The store receives these updates only when the plugin uses the REST API. See [Move the BizPrint plugin for WooCommerce from the Legacy API to the REST API](https://docs.getbizprint.com/developers/legacy-api-migration/) and [Receive print job updates from BizPrint with webhooks](https://docs.getbizprint.com/developers/webhooks/) for what a job contains. |

The add-ons for Print Manager (such as Product Mapping for Print Manager) also use `Zprint\filterLocations`. Use a priority above 11 so your filter runs after them, and only remove locations from the list you receive.

Each location is an object with a `title` property, which is the location’s **Description** on the **Printers** tab. This example skips a location described as “Kitchen” for orders that contain no food items (the `is_food_order()` check is your own code):

```php
add_filter( 'Zprint\filterLocations', function ( $locations, $order ) {
  if ( is_food_order( $order ) ) {
    return $locations;
  }

  return array_filter( $locations, function ( $location ) {
    return 'Kitchen' !== $location->title;
  } );
}, 20, 2 );
```

Do not send a print from `Zprint\printJobStatusUpdate` when a job fails. A job’s status alone does not tell you whether paper came out, and a second print could duplicate it.

## The Print dialog in WordPress

These filters change the **Print** dialog that staff use on the WooCommerce orders screens.

| Filter                                              | Arguments                     | What it does                                                                                      |
| --------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------- |
| `zprint_print_dialog_capability`                    | capability name               | The WordPress capability a user needs to print orders by hand. The default is `edit_shop_orders`. |
| `zprint_print_dialog_allowed_web_printer_locations` | array of printer location IDs | The printer locations a manual print is sent to. Return fewer IDs to block some.                  |

This example lets only users who can manage WooCommerce print orders by hand:

```php
add_filter( 'zprint_print_dialog_capability', function () {
  return 'manage_woocommerce';
} );
```

Which printer locations each user sees is also controlled in the plugin settings. See [Control who can manage BizPrint and use printer locations in WooCommerce](https://docs.getbizprint.com/manage/woocommerce-user-roles/).

## If an order did not print

Do these checks before anyone prints the order again, so it does not print twice:

1. Look at the paper at the printer for that order’s printout. Make sure the order really did not print, and that the printer has paper and shows no error.
2. Check the [print job](https://docs.getbizprint.com/start-here/glossary/#print-job)’s status in the BizPrint dashboard.
3. Wait for the [station](https://docs.getbizprint.com/start-here/glossary/#station) to finish anything it is still printing, whatever status the job shows.
4. Go to **WooCommerce** > **Print Manager** in WordPress.
5. Click the **Support** tab.
6. Check **Queue Status** in [**Print Job Queue**](https://docs.getbizprint.com/start-here/glossary/#print-job-queue).
7. Wait for any pending or processing jobs to finish.
8. Reprint the existing job only if nothing printed and no job for the order is still **pending**, **connecting-to-printer** or **processing**. The reprint goes to the printer the job was first sent to. See [Reprint a print job from the BizPrint dashboard](https://docs.getbizprint.com/print/reprint-a-job/).

## Related pages

- [Build a custom WooCommerce template for BizPrint](https://docs.getbizprint.com/developers/custom-templates/)
- [Receive print job updates from BizPrint with webhooks](https://docs.getbizprint.com/developers/webhooks/)
- [Choose a BizPrint template for WooCommerce printouts](https://docs.getbizprint.com/print/choose-a-template/)
- [BizPrint for developers overview](https://docs.getbizprint.com/developers/)

Need help? Contact BizPrint support at <https://getbizprint.com/support/>.
