Creating a custom PDF template

WooCommerce PDF Invoices & Packing Slips is built with a powerful templating engine, that allows you to completely customize the content and look & feel of the Invoices & Packing Slips to your needs. The basic layout is created with HTML and CSS, and the content is inserted with PHP snippets. If you are going to make changes to the template, you need to copy them to your (child) theme to prevent plugin updates from overwriting the changes you made. This article explains how to do that.

Copying the template files #

The first step in creating custom templates is to copy them to your child theme. If you do not have a child theme, you can also copy the files to your regular theme folder, but since themes also get updated every once in a while, a child theme (which will never get updated automatically) is the safest place to put them.

To create a customized version of the Simple template, copy all the files from the plugin folder:

wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/Simple

to your (child) theme (replace yourtheme by your theme folder):

wp-content/themes/yourtheme/woocommerce/pdf/yourtemplate

If you are using the Professional extension, you also need to copy the Proforma Invoice and Credit note template files from:

wp-content/plugins/woocommerce-pdf-ips-pro/templates/Simple

Many WooCommerce enabled themes will already have the /woocommerce folder – if not, you will need to create it. The /pdf folder is specific for this plugin, and you will always need to create this folder yourself. This is where the plugin will look for the PDF templates. You can have several templates, each in their own folder. The name you give to this folder will be used as the name in your template settings, so this needs to be a unique name. In the example path above, the template will show up as yourtemplate in the template settings. You can use any name you want, although you should avoid special characters.

Don’t forget to select your new template in the plugin settings!

After copying all the files from the Simple template to this folder, finally the structure will look something like this:

Custom PDF template folder structure

Now you are ready to start customizing your PDF templates!

Customizing the template #

Now that you have copied the template files to your child theme, they are safe from plugin updates. Make sure that your newly created template is selected in the General settings tab, then simply open any of the template PHP files (invoice.php, packing-slip.php, etc.) in a text editor and start customizing!