WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WooCommerce PDF Invoices & Packing Slips

Create, print & automatically email PDF invoices & packing slips for WooCommerce orders.

How do I create my own custom template?

Copy the files from wp-content/plugins/woocommerce-pdf-invoices-packing-slips/templates/pdf/Simple/ to wp-content/themes/yourtheme/woocommerce/pdf/yourtemplate and customize them there. The new template will show up as 'yourtemplate' (the folder name) in the settings panel.

Where can I find more templates?

Go to wpovernight.com to checkout more templates! These include templates with more tax details and product thumbnails. Need a custom templates? Contact us at support@wpovernight.com for more information.

Can I contribute to the code?

You're more than welcome! This plugin is hosted on github, where you can post issues or make pull requests. https://github.com/wpovernight/woocommerce-pdf-invoices-packing-slips

My language is not included, how can I contribute?

This plugin is translation ready, which means that you can translate it using standard WordPress methods.

  1. Download POEdit at (http://www.poedit.net/download.php)
  2. Open POEdit
  3. File > New from POT
  4. Open wpo_wcpdf.pot (from woocommerce-pdf-invoices-packing-slips/languages/)
  5. A popup will ask you for your language
  6. This step is a bit tricky, configuring the plurals. Somehow the settings can't be copied from the pot. Go to Catalogue > Preferences. Then enter nplurals=2; plural=n != 1; in the custom expression field
  7. Enter the translations. invoice and packing-slip now have two translation fields, single & plural. Note that this is a filename, so replace spaces with a - just to be sure!
  8. Save as wpo_wcpdf-xx_XX.po, where you replace xx_XX with your language code & country code suffix (da_DK, pl_PL, de_DE etc.)

How can I display custom fields in the invoice or packing slip?

First, you need to create a custom template following instructions from the first item in this FAQ. Then place the following snippet where you would like the custom field to appear:

<?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:'); ?>

Where you replace 'custom_fieldname' with the name of the field you want to display, and 'Custom field' with the label. The plugin only displays the field when it contains data. If you also want to display the label when the field is empty, you can pass a third parameter (true), like this:

<?php $wpo_wcpdf->custom_field('custom_fieldname', 'Custom field:',  true); ?>

How do can I modify the pdf filename?

You can do this via a filter in your theme's functions.php (Some themes have a "custom functions" area in the settings).

For the export filename (from the woocommerce admin or the my account page):

add_filter( 'wpo_wcpdf_bulk_filename', 'my_pdf_bulk_filename', 10, 4 );
function my_pdf_bulk_filename( $filename, $order_ids, $template_name, $template_type ) {
    global $wpo_wcpdf;
    if (count($order_ids) == 1) {
        // single
        $invoice_number = $wpo_wcpdf->get_invoice_number();
        $filename = 'myshopname_' . $template_name . '-' . $invoice_number . '.pdf';
    } else {
        // multiple invoices/packing slips export
        // create your own rules/ be creative!
    }

    return $filename;
}

For the email attachment filename:

add_filter( 'wpo_wcpdf_attachment_filename', 'my_pdf_attachment_filename', 10, 3 );
function my_pdf_attachment_filename( $filename, $display_number, $order_id ) {
    //$display_number is either the order number or invoice number, according to your settings
    $filename = 'myshopname_invoice-' . $display_number . '.pdf';

    return $filename;
}

Why does the download link not display on the My Account page?

To prevent customers from prematurely creating invoices, the default setting is that a customer can only see/download an invoice from an order that already has an invoice - either created automatically for the email attachment, or manually by the shop manager. This means that ultimately the shop mananger determines whether an invoice is available to the customer. If you want to make the invoice available to everyone you can either of the following:

  1. Change the email setting to attach invoices to processing and/or new order emails as well
  2. Add a filter to your themes functions.php for greater control:
add_filter( 'wpo_wcpdf_myaccount_allowed_order_statuses', 'wpo_wcpdf_myaccount_allowed_order_statuses' );
function wpo_wcpdf_myaccount_allowed_order_statuses( $allowed_statuses ) {
    // Possible statuses : pending, failed, on-hold, processing, completed, refunded, cancelled
    $allowed_statuses = array ( 'processing', 'completed' );

    return $allowed_statuses;
}

How can I get a copy of the invoice emailed to the shop manager?

The easiest way to do this is to just tick the 'new order' box. However, this also means that an invoice will be created for all new orders, also the ones that are never completed.

Alternatively you can get a (BCC) copy of the completed order email by placing the following filter in your theme's functions.php (Some themes have a "custom functions" area in the settings) Modify the name & email address to your own preferences,

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);

function mycustom_headers_filter_function( $headers, $object ) { 
    if ($object == 'customer_completed_order') { 
        $headers .= 'BCC: Your name <your@email.com>' . "\r\n"; //just repeat this line again to insert another email address in BCC
    }

    return $headers; 
}

Fatal error: Allowed memory size of ######## bytes exhausted (tried to allocate ### bytes)

This usually only happens on batch actions. PDF creation is a memory intensive job, especially if it includes several pages with images. Go to WooCommerce > System Status to check your WP Memory Limit. We recommend setting it to 128mb or more.

Requires: 3.5 and WooCommerce 2.0 or higher
Compatible up to: 3.9.1 and WooCommerce 2.1
Last Updated: 2014-7-17
Downloads: 26,638

Ratings

4 stars
5 out of 5 stars

Support

33 of 38 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,2,2
100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 67,3,2 100,1,1
100,1,1