How to Remove or Customize Data on Your WooCommerce PDF Invoices and Packing Slips
Content
Customizing the appearance of your PDF invoices and packing slips is a common need for WooCommerce store owners. Whether you want to remove specific information like SKUs, weights, or shipping methods, or simply change the layout to better fit your workflow, the 'PDF Invoices & Packing Slips for WooCommerce' plugin offers several ways to achieve this. This guide covers the most effective methods for removing and customizing data on your PDF documents.
Why Customize Your PDF Documents?
There are many reasons you might want to tweak the default PDF output. You may need to hide information that's irrelevant for internal packing, remove sensitive data, comply with regional invoice requirements, or simply make the document layout cleaner and more professional. Common requests include removing the shop name, subtotals, SKUs, weights, shipping method details, or specific order metadata.
Method 1: Using Custom CSS (Quickest Solution)
For simple visual changes like hiding elements, adding borders, or changing text formatting, custom CSS is often the fastest approach. The plugin provides a hook specifically for this purpose.
Example: Hiding the Shop Name and Product Metadata
add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {
?>
.shop-name, .item-meta {
display: none;
}
<?php
}, 10, 2 );
Example: Adding Lines Between Order Items
add_action( 'wpo_wcpdf_custom_styles', function( $document_type, $document ) {
?>
.order-details tr {
border-bottom: 1px lightgray solid;
}
<?php
}, 10, 2 );
How to Use This Code: Add this code to your child theme's functions.php file or a code snippets plugin. The .shop-name and .item-meta are CSS classes used in the PDF template. You can find other selectors by inspecting the HTML structure of your PDF document.
Method 2: Using Filter Hooks for Functional Changes
When you need to modify data or functionality rather than just hide elements, filter hooks are more appropriate. These PHP snippets can change document titles, modify addresses, or remove bulk actions.
Example: Changing the Packing Slip Title
add_filter( 'wpo_wcpdf_packing_slip_title', function( $title, $document ) {
$title = 'Packing Slip/Delivery Order';
return $title;
}, 10, 2 );
Example: Removing Bulk PDF Actions from the Orders List
add_filter( 'wpo_wcpdf_bulk_actions', '__return_empty_array' );
Method 3: Creating a Custom Template (Most Flexible)
For complete control over the layout and content, creating a custom PDF template is the best long-term solution. This involves copying the plugin's template files to your child theme and modifying them directly. This method prevents your customizations from being lost during plugin updates.
Steps to Create a Custom Template:
- In your WordPress admin, go to WooCommerce > PDF Invoices > Status and check the path for template files.
- Copy the template files you want to modify (e.g.,
invoice.phporpacking-slip.php) from the plugin's directory to a new folder in your child theme:your-child-theme/woocommerce/pdf-invoices. - Edit the copied files in your child theme to remove or rearrange elements as needed.
Important Note: When editing template files, it's crucial to understand the PHP code structure. For example, if you want to remove only the subtotal from the totals section, you would need to identify and conditionally exclude the specific loop that generates that line, rather than deleting code that controls all totals.
Method 4: Plugin Settings
Before resorting to code, always check the plugin's settings. Some display options can be controlled directly from the dashboard. For instance, to prevent customers from downloading invoices from their 'My Account' page, you can navigate to WooCommerce > PDF Invoices > Documents > Invoice and set "Allow My Account invoice download" to "Never".
Troubleshooting Common Issues
- Changes don't appear: Clear any caching plugins and regenerate the PDF to see your changes.
- Broken layout after editing templates: Double-check your PHP syntax. A missing bracket or semicolon can break the entire document.
- Unexpected elements appearing: Some data, like shipping method details or custom metadata, might be added by other plugins. You may need to identify the specific CSS class or hook related to that data.
- Need to hide specific order meta: If custom CSS hides too much (like all metadata when you only want to hide some), you may need a more targeted approach using template edits or advanced filters.
Conclusion
Customizing your WooCommerce PDF documents doesn't have to be complicated. For quick visual tweaks, start with custom CSS. For functional changes like modifying titles, use filter hooks. For complete layout control, create a custom template in your child theme. Always test changes in a staging environment first, and remember that using a child theme protects your customizations from being overwritten during updates.
Related Support Threads Support
-
Change Document Titlehttps://wordpress.org/support/topic/change-document-title/
-
Hide Invoicehttps://wordpress.org/support/topic/hide-invoice/
-
Move customer name to the TOPhttps://wordpress.org/support/topic/move-customer-name-to-the-top/
-
Change name for Packing Sliphttps://wordpress.org/support/topic/change-name-for-packing-slip/
-
Remove Backordered and ETA from Invoice & Packing Sliphttps://wordpress.org/support/topic/remove-backordered-and-eta-from-invoice-packing-slip/
-
[Order View] – Remove “PDF actions” from “Bulk actions” listhttps://wordpress.org/support/topic/order-view-remove-pdf-actions-from-bulk-actions-list/
-
Remove “pdf Document Data” from order pageshttps://wordpress.org/support/topic/remove-pdf-document-data-from-order-pages/
-
How to remove address from invoice slip?https://wordpress.org/support/topic/how-to-remove-address-from-invoice-slip/
-
Remove hover tooltiphttps://wordpress.org/support/topic/remove-hover-tooltip/
-
How to hide the shipping method name from the “delivery note” ?https://wordpress.org/support/topic/how-to-hide-the-shipping-method-name-from-the-delivery-note/
-
Change postal adress position to right sidehttps://wordpress.org/support/topic/change-postal-adress-position-to-right-side/
-
Change Shipping Address positionhttps://wordpress.org/support/topic/change-shipping-address-position/
-
Replace shipping address to relay point addresshttps://wordpress.org/support/topic/replace-shipping-address-to-relay-point-address/
-
Hide Category From Packing Sliphttps://wordpress.org/support/topic/hide-category-from-packing-slip/
-
Rearrange PDF Document Data on order screenhttps://wordpress.org/support/topic/rearrange-pdf-document-data-on-order-screen/
-
Customize PDF Invoice Fieldshttps://wordpress.org/support/topic/customize-pdf-invoice-fields/
-
Remove Action – Invoice button on order confirmation pagehttps://wordpress.org/support/topic/remove-action-invoice-button-on-order-confirmation-page/
-
Hide Radio Button from Invoice PDFhttps://wordpress.org/support/topic/hide-radio-button-from-invoice-pdf/
-
Sort alphabetically productshttps://wordpress.org/support/topic/sort-alphabetically-products/
-
Method ID, Instance ID and cost showing on Packing listhttps://wordpress.org/support/topic/method-id-instance-id-and-cost-showing-on-packing-list/
-
Text indentinghttps://wordpress.org/support/topic/text-indenting/
-
Custom Date Fieldhttps://wordpress.org/support/topic/custom-date-field-3/
-
Underline wordshttps://wordpress.org/support/topic/underline-words/
-
Text indentinghttps://wordpress.org/support/topic/text-indenting-2/
-
print costumer notes above products detailshttps://wordpress.org/support/topic/print-costumer-notes-above-products-details/
-
SKU and Weight removalhttps://wordpress.org/support/topic/sku-and-weight-removal/
-
Lines between order itemshttps://wordpress.org/support/topic/lines-between-order-items/
-
Remove Weight From Line Items On PDF Invoicehttps://wordpress.org/support/topic/remove-weight-from-line-items-on-pdf-invoice/
-
Remove subtotal from custom PDF invoicehttps://wordpress.org/support/topic/remove-subtotal-from-custom-pdf-invoice/
-
Hide stock notificationhttps://wordpress.org/support/topic/hide-stock-notification/
-
Scandinavian letters (Ä, Ö, Å) broking the packing sliphttps://wordpress.org/support/topic/scandinavian-letters-a-o-a-broking-the-packing-slip/
-
Change position of address and order datahttps://wordpress.org/support/topic/change-position-of-address-and-order-data/
-
Remove Billing Address From Invoicehttps://wordpress.org/support/topic/remove-billing-address-from-invoice/
-
Hiding the shipping rate when shipping is freehttps://wordpress.org/support/topic/hiding-the-shipping-rate-when-shipping-is-free/
-
Hide Shop Name On Invoicehttps://wordpress.org/support/topic/hide-shop-name-on-invoice/