November 14, 2026

Career Flyes

Fly With Success

WooCommerce PDF Invoices Packing Slips After Footer Hook: WooCommerce Hooks vs WordPress Filters for Customizing PDF Documents

5 min read

Use the after footer hook when you need to add visible content after the PDF footer, and use WordPress filters when you need to change existing values before the PDF is rendered. For WooCommerce PDF invoices and packing slips, that difference matters. An action hook prints or runs extra behavior. A filter changes data and returns it. Mixing the two is where many store owners lose time.

TLDR: The after footer hook is best for adding extra text, compliance notes, QR codes, payment reminders, or warehouse instructions below the footer area of a PDF document. A WordPress filter is better when you want to change a label, filename, address field, or invoice number format. For example, a store sending 2,000 invoices per month could add a tax disclaimer after the footer on every invoice, while using a filter to rename PDF files from invoice 1234.pdf to acme invoice 1234.pdf. That split keeps the customization cleaner and easier to maintain.

What the after footer hook actually does

In the WooCommerce PDF Invoices & Packing Slips plugin, PDF templates are built with PHP, HTML, and CSS. The template renders sections such as the header, shop details, order data, customer address, order table, totals, notes, and footer.

The after footer hook runs after the document footer has been output. In many setups, this hook is named something like wpo_wcpdf_after_footer. It is usually treated as an action hook, not a filter.

That means it is designed to do something. Most often, it prints extra HTML into the PDF.

  • Good use: Add a legal notice below the footer.
  • Good use: Add a returns policy summary.
  • Good use: Show a warehouse handling note on packing slips.
  • Poor use: Change the invoice number itself.
  • Poor use: Rename the PDF file.

Honestly, it feels like this distinction should be obvious in plugin settings, but it often is not. A merchant may spend 30 minutes editing template files when a five-line action in a small plugin would have worked.

WooCommerce hooks vs WordPress filters

WordPress uses a hook system. There are two main types: actions and filters. WooCommerce and PDF invoice plugins add their own hook names to that same system.

Actions run at a certain point. They can output content, send data, log events, or trigger another function. They do not need to return a modified value.

Filters receive a value, change it, and return it. If you forget to return the value, you may break the output. That is one of the most common mistakes in invoice customization.

Think of it this way:

  • Action: “Add this paragraph after the footer.”
  • Filter: “Change this footer text before it is printed.”

The after footer hook belongs on the action side. It is a location-based insertion point. A filter is a value-based modification point.

A practical after footer example

Here is a simplified example that adds a compliance note after the PDF footer. This should go in a small custom plugin or a safe snippet manager. A child theme can work, but it is not always the best place for business documents.

add_action( 'wpo_wcpdf_after_footer', 'my_pdf_after_footer_note', 10, 2 );

function my_pdf_after_footer_note( $document_type, $order ) {
    if ( $document_type !== 'invoice' ) {
        return;
    }

    echo '<div class="after-footer-note">';
    echo esc_html__( 'This invoice was issued electronically and is valid without a signature.', 'my-textdomain' );
    echo '</div>';
}

This example checks that the document type is an invoice. It then prints a short note. That prevents the same text from appearing on packing slips, unless you want it there.

You can style the output with PDF template CSS:

.after-footer-note {
    margin-top: 8mm;
    font-size: 9px;
    color: #555;
    text-align: center;
}

Keep the styling simple. PDF engines are not browsers. Some CSS works well. Some CSS behaves badly. Expect to waste time on spacing if you use floats, complex positioning, or large images.

When to use a filter instead

Use a filter when the plugin gives you a value and expects you to return a changed version of that value. Typical filter tasks include changing document titles, filenames, address formats, labels, or custom field output.

For example, if you want to alter the PDF filename, an action after the footer is the wrong place. The PDF has already moved far beyond filename logic by then. You need the correct filename filter supplied by the plugin.

A filter often looks like this:

add_filter( 'example_pdf_filename', 'my_custom_pdf_filename', 10, 2 );

function my_custom_pdf_filename( $filename, $order ) {
    $order_number = $order->get_order_number();
    return 'invoice-' . sanitize_file_name( $order_number ) . '.pdf';
}

This is only a pattern. Use the exact filter name documented by your PDF invoice plugin. Guessing hook names is risky. It may work once, then fail after an update.

Best uses for the after footer hook

The after footer hook is most useful for content that must apply to the whole document and sit outside the main order table.

  • Tax statements: VAT reverse charge notes, exemption notices, or regional invoice wording.
  • Legal text: Company registration numbers, dispute clauses, or electronic invoice notices.
  • Payment notes: Bank transfer reminders, due date warnings, or late fee notices.
  • Return instructions: Short return window text for customers.
  • Internal warehouse notes: Packing rules that should not affect customer invoice data.

Be careful with sensitive data. Do not print internal margin notes or fraud scores on customer-facing invoices. If you add order meta, check who will receive the PDF.

Common mistakes that cause broken PDFs

Small errors can break document generation. PDF rendering can be less forgiving than a normal web page.

  • Echoing unescaped data: Always escape customer names, addresses, and custom fields.
  • Using a filter like an action: Filters must return a value.
  • Using an action like a filter: Actions are not meant to replace existing values.
  • Editing plugin files: Updates can erase the work.
  • Adding heavy images: Large logos or QR files can slow PDF creation.
  • Ignoring document type: Invoice notes may accidentally appear on packing slips.

A real annoyance: one oversized image can add several seconds to PDF generation on a busy store. That delay feels small during testing. At 500 orders, it becomes a support ticket.

How to choose the right method

Use this simple rule:

  • If you are adding new visible content: use an action hook.
  • If you are changing existing data: use a filter.
  • If you need layout control: use template overrides with care.
  • If the change is store-critical: place it in a custom plugin, not a theme file.

Template overrides are useful, but they carry maintenance cost. If the plugin updates its template structure, your override may miss fixes or new features. Hooks and filters are usually safer for small changes.

Trustworthy implementation checklist

  • Confirm the exact hook or filter name in the plugin documentation.
  • Test with an invoice, packing slip, refund, and completed order.
  • Check the PDF in email attachments and admin downloads.
  • Escape all output with functions such as esc_html().
  • Keep PDF CSS basic and predictable.
  • Document the change in your internal store notes.
  • Retest after plugin, WooCommerce, and PHP updates.

The WooCommerce PDF Invoices Packing Slips after footer hook is a precise tool. Use it to add content after the footer, not to reshape core document data. WordPress filters serve a different job: they change values before output. When those roles stay separate, custom PDF documents remain cleaner, safer, and easier to support.