This documentation is for the older version of the WooCommerce PDF Invoices, Packing Slips, Delivery Notes, and Shipping Labels plugin. If you are using the new version of the plugin, please note that this documentation no longer applies to you. Find the relevant documentation from here :

WooCommerce PDF Invoices, packing slips and credit notes plugin | WooCommerce Shipping labels, Dispatch labels and Delivery notes plugin | WooCommerce Address labels plugin | WooCommerce Picklists plugin | WooCommerce Proforma invoices plugin | Customizer for WooCommerce PDF Invoices

Home > Docs > WooCommerce PDF Invoices, Packing Slips, Delivery Notes and Shipping Labels > Use of Predefined Filters in WooCommerce Documents

Use of Predefined Filters in WooCommerce Documents

Last updated on November 12, 2024

WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Label plugin handles all e-commerce document requirements. It consists of specific settings to configure the document types according to your desired functionality. You can even customize each document layout and append necessary details into it.

Apart from existing features, the plugin also provides additional filters to extend plugins’ functionality. Insert the common info used across all the documents in the General settings window.

In order to get access to these filters, first of all, install and activate the plugin.

Filters

Navigate to the Invoice/Packing >General settings of the plugin from the WooCommerce dashboard. It consists of a Help Guide tab which is further classified into Help Links and Filters.

Help links will take you directly to the documentation and support. The Filters will list out various code snippets that help to extend the underlying plugin functionality.

WooCommerce Invoice or Packing Slip-Help-Filter List
WooCommerce Invoice or Packing Slip-Help-Filter List

You can expand a filter to get its code snippet, copy the code and paste it in the functions.php of your active child theme.

Show/hide the ‘Received’ seal

For example, to hide the received seal in the invoice of refunded orders, you can use the filter wf_pklist_toggle_received_seal.  

  • Scroll down the page and locate the filter.
  • Then, expand the code and copy the code as shown below:
WooCommerce Invoice or Packing Slip-Alter Order Date Filters
  • Next, you will have to paste the code into the functions.php of active theme file.

Likewise, you can customise the filter wf_pklist_toggle_received_seal in the following manner.

Show ‘Received’ seal only for completed orders

Please use the below code snippet to print the Received seal for the completed order status. Copy the code to your active theme’s functions.php file.
Note: Received seal must be enabled in the active template. (you can edit that received text to “Paid”, which is located in the customize tab)

add_filter('wf_pklist_toggle_received_seal','wf_pklist_toggle_received_seal_fn', 10, 3);
function wf_pklist_toggle_received_seal_fn($is_enable_received_seal, $template_type, $order)
{
	return ($order->get_status()=='completed');
}

Show ‘Cancelled’ seal for cancelled orders

Use the code snippet for showing cancelled seal for cancelled orders and received seal for completed orders. Copy the code to your active theme’s functions.php file.

add_filter('wf_pklist_alter_find_replace','wt_pklist_alter_received_seal_text' ,10,6);
function wt_pklist_alter_received_seal_text($find_replace, $template_type, $order, $box_packing, $order_package, $html)
{
	if($template_type=='invoice' )
	{
		if($order->get_status()=='cancelled')
		{
			$find_replace['[wfte_received_seal_text]']=__('Cancelled');
		}
		else
		{
			$find_replace['[wfte_received_seal_text]']=__('Received');
		}
	}
	return $find_replace;
}

Know more about date constants, refer to the article.