WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Label plugin is equipped to handle 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. Each filter is incorporated to serve distinct purposes.
In order to get access to these filters, first of all, install and activate the plugin from the WooCommerce dashboard. Navigate to the general settings of the plugin.
It is in the general settings where all the common information pertaining to various shipping documents are configured. 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 which help to extend the underlying plugin functionality.
You can expand a filter to get its code snippet, copy the code and paste it in the function.php of your active child theme.
For example, to change the default appearance of the order date in the invoice, you can use the filter Alter order date. You can simply copy the corresponding code snippet by expanding the filter as shown below:
Next, you will have to paste the code into the function.php file.
add_filter( 'wf_pklist_alter_order_date', 'wt_pklist_change_order_date_format', 10, 3);
function wt_pklist_change_order_date_format($order_date, $template_type, $order)
/* new date format */
It is to be noted that, the filter should be placed within the concerned function with an adequate number of arguments placed appropriately within the parenthesis. In the above example, wf_pklist_alter_order_date is the filter name and wt_pklist_change_order_date_format is the function name. Also, the return date format is specified as “Y-m-d” which means the order date will be displayed as Date:2019-09-26. However, you can insert the values accordingly to get your desired style. If “Y-M-d” is used, then the order date will be displayed as Date:2019-Sep-26.
To know more about various date constants that can be used, refer to the article.