WooCommerce Print Invoices & Packing Lists: Developer Reference

WooCommerce Print Invoices / Packing Lists includes several actions and filters to customize your invoices and packing lists.

This document is provided as a courtesy for developers and designers. Please note that we do not support or offer customization services as part of our support policy. Any sample code provided is simply for reference.

Document Template Actions ↑ Back to top

wp_pip_head

Params: $type, $document, $order
Fires inside the document’s <head> element.

wc_pip_styles

Params: None
Fires inside the document’s <style> element to allow for custom CSS.

Example: Adding a thumbnail column to documents with styles

wc_pip_before_header

Params: $type, $action, $document, $order
Fires before the document’s header.

wc_pip_header

Params: $type, $action, $document, $order
Fires inside the document’s header after company information.

wc_pip_after_customer_addresses

Params: $type, $action, $document, $order
Fires after the customer’s address is printed on the document.

wc_pip_after_header

Params: $type, $action, $document, $order
Fires after the document’s header.

wc_pip_before_body

Params: $type, $action, $document, $order
Fires before the document’s body (order table).

wc_pip_after_body

Params: $type, $action, $document, $order
Fires after the document’s body (order table).

wc_pip_order_details_after_customer_details

Params: $type, $action, $document, $order
Fires after customer details.

wc_pip_before_footer

Params: $type, $action, $document, $order
Fires before the document’s footer.

wc_pip_after_footer

Params: $type, $action, $document, $order
Fires after the document’s footer.

Document Template Filters ↑ Back to top

wc_pip_document_title

Params: $title, $type, $document, $order
Return: (string) $title
Filters the document’s title.

wc_pip_show_print_dialog

Params: $show_print_dialog
Return: (bool)
Filters if the print dialog should be shown automatically when the document loads. Defaults to true.

Example:
You can disable the automatic print dialog with the following line:
add_filter( 'wc_pip_show_print_dialog', '__return_false' );

wc_pip_billing_address

Params: $billing_address, $type, $order
Return: (string) $billing_address
Filters the customer’s billing address.

wc_pip_shipping_address

Params: $shipping_address, $type, $order
Return: (string) $shipping_address
Filters the customer’s shipping address.

Document Actions ↑ Back to top

wc_pip_invoice_number_created

Params: $invoice_number, $order
Fires after an invoice number is created.

wc_pip_order_item_meta_start

Params: $item_id, $item, $order
Fires before order item meta HTML.

wc_pip_order_item_meta_end

Params: $item_id, $item, $order
Fires after order item meta HTML.

wc_pip_print

Params: $type, $order_id, $order_ids
Fires immediately before the document is output for printing.

wc_pip_send_email_{$document_type}

Params: $document
Triggers the document email. $document_type is one of invoice, packing_list, or pick_list.

wc_pip_send_email

Params: $type, $order_id, ~~$order_ids
Fires after the document’s email is sent.

Document Filters ↑ Back to top

wc_pip_document_show_shipping_address

Params: $show_shipping_address, $type, $order
Return: (bool)
Filters if the customer shipping address should be shown in the document.

wc_pip_document_show_billing_address

Params: $show_billing_address, $type, $order
Return: (bool)
Filters if the customer billing address should be shown in the document.

wc_pip_document_show_terms_and_conditions

Params: $show_terms_and_conditions, $type, $order
Return: (bool)
Filters if the terms & conditions should be shown in the document.

wc_pip_document_shipping_method

Params: $shipping_method, $type, $order
Return: (string) $shipping_method
Filters the shipping method(s) and returns the formatted method.

Example: Add order delivery dates to documents

wc_pip_document_coupons_used

Params: $coupons, $type, $order
Return: (array) $coupons
Filters the document’s coupons used.

wc_pip_document_customer_details

Params: $customer_details, $order_id, $type
Return: (array) $customer_details
Filter the document’s customer details.

wc_pip_document_customer_note

Params: $customer_note, $order_id, $type
Return: (string) $customer_note
Filter’s the document’s customer note and returns the customer note HTML.

wc_pip_invoice_date

Params: $invoice_date, $order_date, $order_id, type
Return: (string) $invoice_date
Filter’s the invoice date.

wc_pip_invoice_number

Params: $invoice_number, $order_id, $type
Return: (string) $invoice_number
Filters the invoice number and returns the formatted number (with merge tags).

wc_pip_document_header

Params: $header, $order_id, $type
Return: (string) $header
Filters the document header and returns document header HTML.

wc_pip_document_footer

Params: $footer, $order_id, $type
Return: (string) $footer
Filters the document footer and returns document footer HTML.

wc_pip_document_company_logo_max_width

Params: $size, $order_id, $type
Return: (string) $size
Filters the logo max width (returns a string, not integer, for px width).

wc_pip_document_company_logo

Params: $image_html, $image_url, $order_id, $type
Return: (string) $image_html
Filters the company logo and returns the image HTML.

wc_pip_document_company_name

Params: $company_name, $order_id, $type
Return: (string) $company_name
Filters the company name.

wc_pip_document_company_extra_info

Params: $company_extra_info, $order_id, $type
Return: (string) $company_extra_info
Filters the company extra info.

wc_pip_document_company_url

Params: $company_url, $order_id, $type
Return: (string) $company_url
Filters the company url.

wc_pip_document_company_address

Params: $company_address, $order_id, $type
Return: (string) $company_address
Filters the company address.

wc_pip_document_terms_and_conditions

Params: $terms_and_conditions, $order_id, $type
Return: (string) $terms_and_conditions
Filters the return policy.

wc_pip_document_table_headers

Params: $table_headers, $order_id, $type
Return: (array) $table_headers
Filters the table headers.

wc_pip_document_column_widths

Params: $column_widths, $order_id, $type
Return: (array) $column_widths
Filters the table column widths.

wc_pip_order_items_count

Params: $count, $items, $order
Return: (int) $count
Filters the order items count.

wc_pip_document_sort_order_items_key

Params: $sort_key, $order_id, $type
Return: string $sort_key
Filters how items in document tables should be sorted. Defaults to product to sort products together by category / name.

Example: Change how line items are sorted by document

wc_pip_document_table_rows

Params: table_rows, $items, $order_id, $type
Return: (array) $table_rows
Filters the document’s table rows.

wc_pip_order_item_visible

Params: $item_visible, $item, $type
Return: (bool)
Filters if the order item should be visible on the document. Defaults to true.

wc_pip_document_table_row_item_data

Params: $item_data, $item, $product, $order_id, $type
Return: (array) $item_data
Filters the table row item data.

wc_pip_document_table_product_class

Params: $product_class, $product
Return: (string) $product_class
Filters the order item product CSS class.

wc_pip_order_item_name

Params: $product_name, $item, $is_visible, $document_type, $product, $order
Return: (string) $product_name
Filters the order item product name HTML.

wc_pip_order_item_weight

Params: $items_weight, $item_id, $item, $product, $order
Return: (float) $items_weight
Filters the total weight of the item in the order (unit weight × quantity).

wc_pip_document_table_row_item_meta_flat

Params: $flat, $product, $item_id, $item, $type, $order
Return: (bool)
Filters if item meta should be displayed flat. Defaults to definition list (item meta is displayed on new lines).

wc_pip_document_table_row_cells

Params: $table_row_cells, $type, $item_id, $item, $product, $order
Return: (string) $table_row_cells
Filters the document table cells.

wc_pip_document_table_footer

Params: $rows, $type, $order_id
Return: (string) $rows
Filters the document table footer.

wc_pip_order_items_total_weight

Params: $formatted_weight, $total_weight, $weight_unit, $order
Return: (string) $formatted_weight
Filters the total weight of items in the order and returns the formatted weight HTML.

wc_pip_invoice_email_subject

Params: $subject, $document
Return: (string) $subject
Filter the invoice email subject.

wc_pip_packing_list_email_subject

Params: $subject, $document
Return: (string) $subject
Filter the packing list email subject.

wc_pip_packing_list_exclude_item

Params: $exclude, $product, $item, $item_data
Return: (bool)
Filters if an order item should be excluded from the packing list.

wc_pip_pick_list_email_subject

Params: $subject, $document
Return: (string) $subject
Filter the pick list email subject.

General Actions ↑ Back to top

wc_pip_process_orders_bulk_action_send_email

Params: $document_type, $order_ids
Fires after emails are sent via a bulk action.

wc_pip_process_orders_bulk_action

Params: $action_type, $document
Fires after order bulk action is processed.

General Filters ↑ Back to top

wc_pip_can_manage_documents

Params: $capabilities
Return: (array) $capabilities
Filters the user capabilities that can manage documents.

wc_pip_document_types

Params: $types
Return: (array) $types
Filters the document types.

wc_pip_merge_tags

Params: $merge_tags, $context
Return: (array) $merge_tags
Filters the merge tags used for invoice field replacements.

wc_pip_generate_invoice_number_on_order_paid

Params: $generate_invoice
Return: (bool)
Toggles the automatic generation of an invoice number when an order is paid.

wc_pip_my_account_invoice_order_statuses

Params: $order_statuses, $order
Return: (array) $order_statuses
Filters the order statuses valid to display an invoice to the customer on the My Account page.

wc_pip_get_settings_sections

Params: $sections, $wc_pip_settings_instance
Return: (array) $sections
Filters the plugin’s settings sections.

wc_pip_settings_hide_save_button

Params: $hide_save_button, $current_section
Return: (bool)
Filters if the plugin’s settings save button should be hidden. Defaults to true on the General sub-tab, false otherwise.

wc_pip_settings

Params: $settings, $current_section, $wc_pip_settings_instance
Return: (array) $settings
Filters the plugin’s settings.

wc_pip_general_settings

Params: $settings, $wc_pip_settings_instance
Return: (array) $settings
Filters the general settings.

wc_pip_invoice_settings

Params: $settings, $wc_pip_settings_instance
Return: (array) $settings
Filters the invoice settings.

wc_pip_packing_list_settings

Params: $settings, $wc_pip_settings_instance
Return: (array) $settings
Filters the packing list settings.

wc_pip_admin_order_actions

Params: $actions
Return: (array) $actions
Filters the admin order actions.a

wc_pip_admin_order_bulk_actions

Params: $actions
Return: (array) $actions
Filters the bulk order actions.


Other snippet examples can be found in the SkyVerge plugin snippet repository.

User Documentation ↑ Back to top

Return to user documentation →

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top