Including a clear description of the product or service offered by a WooCommerce store is a trivial part of invoicing. An invoice would need to include product-specific attributes and meta fields. This can be achieved using the plugin Customization option. New attributes and meta fields are added from the Add new column dialogue box.
Prerequisite
- A WooCommerce store with WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels extension enabled.
- Invoice enabled from the General settings tab.
Adding product meta or order item meta as a new column in invoices
Follow the below steps to add an order item meta or a product meta as a new column in WooCommerce invoices:
- From the WordPress dashboard, navigate to Invoice/Packing > Invoice > Customize.
- Within the Customize tab, head to the Product table of the active invoice template and click on it. This will display the product table elements in the Editor Pane on the right.
- Now, click on the “+” Icon at the top-right corner of the Editor pane. This displays the Add new column dialogue box.
- Within the dialogue box, enter a suitable title for the new column in the Column header text box.
- Select a value to display in the new column from the dropdown. To display product meta, select Product meta from the dropdown, and to display order item meta, select Order item meta from the dropdown.
- On selecting a value, enter the appropriate meta key.
- Click on Save to apply the changes.
- Finally, click on Save and activate to apply the changes to the active invoice template.
The image below shows a sample WooCommerce invoice upon adding a product meta (Weight) and an order item meta (Product ID) to the product table.
Steps to add a product attribute as a new column
Implement the following steps to add a new column to the product table of an invoice.
- Click on Invoices/Packing > Invoices in the WordPress dashboard to reach the WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels settings.
- Click on the Customize tab. This displays the default template of the Invoice.
- In the Customization window, move to the Product table in the Preview Pane and select it. This will display the Settings of the product table in the Editor Pane.
- Click on the “+” Icon in the top-right corner of the Editor pane. This displays the Add new column dialogue box.
- In the Dialogue box that appears, enter the name of the new column in the Column header text box.
- We can add product attributes as new columns to the product table using Filter. In the Select a value list box, select the Filter option. This option adds custom values to the product table. We use column keys to identify the column on the filter.
In the following example, we display the product attribute – color using Filter. Here, attribute is the column key. The values are entered as shown in the image below.
Add the following code to the function.php file to create a sample filter that gets the color value.
Sample Invoice pdf after adding a new column using filters is as follows: