Cart PDF for WooCommerce 3.4.0 has 8 actions and 31 filters, read directly from its source code on Nov 18, 2026. The list updates automatically when a new version is released.
How to use these hooks
Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.
// Run your own code when Cart PDF for WooCommerce fires an action
add_action( 'wc_cart_pdf_after_template', function() {
// Your code runs here.
}, 10, 1 );
// Change a value Cart PDF for WooCommerce is about to use
add_filter( 'wc_cart_pdf_mpdf', function( $mpdf ) {
// Change $mpdf here.
return $mpdf;
}, 10, 1 );Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.
All hooks
-
/** * After template hook */ do_action( 'wc_cart_pdf_after_template' ); -
/** * Before template hook */ do_action( 'wc_cart_pdf_before_template' ); -
/** * Hook to modify mPDF object before generating */ apply_filters( 'wc_cart_pdf_mpdf', $mpdf ); -
/** * Perform custom actions after PDF generated */ do_action( 'wc_cart_pdf_output', $mpdf ); -
apply_filters( 'wc_cart_pdf_filename', 'WC_Cart-' . gmdate( 'Ymd' ) . bin2hex( openssl_random_pseudo_bytes( 5 ) ) ); -
apply_filters( 'wc_cart_pdf_thumbnail_height', 60 ); -
apply_filters( 'wc_cart_pdf_thumbnail_width', 60 ); -
apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ); -
apply_filters( 'wc_cart_pdf_admin_copy_body', $body, $customer ); -
apply_filters( 'wc_cart_pdf_admin_copy_email', get_option( 'admin_email' ), $mpdf, $customer ); -
apply_filters( 'wc_cart_pdf_admin_copy_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $customer ); -
apply_filters( 'wc_cart_pdf_admin_copy_subject', esc_html__( 'A user has downloaded their cart as PDF', 'wc-cart-pdf' ), $customer ); -
do_action( 'wc_cart_pdf_before_process' ); -
apply_filters( 'wc_cart_pdf_capture_customer_fields', array( 'email', 'first_name', 'last_name', 'display_name', 'username', 'billing_first_name', 'billing_last_name', 'billing_company', 'billing_address_1', 'billing_address_2', 'billing_city', 'billing_postcode', 'billing_country', 'billing_state', 'billing_email', 'billing_phone', 'shipping_first_name', 'shipping_last_name', 'shipping_company', 'shipping_address_1', 'shipping_address_2', 'shippi... ); -
apply_filters( 'wc_cart_pdf_content', ob_get_clean() ); -
apply_filters( 'wc_cart_pdf_destination', $dest ); -
apply_filters( 'wc_cart_pdf_modal_email_body', $body, $customer ); -
apply_filters( 'wc_cart_pdf_modal_email_copy_default', true ); -
apply_filters( 'wc_cart_pdf_modal_email_headers', array( 'Content-Type: text/html; charset=UTF-8' ), $customer ); -
apply_filters( 'wc_cart_pdf_modal_email_recipient', $customer->get_billing_email(), $mpdf, $customer ); -
apply_filters( 'wc_cart_pdf_modal_email_subject', sprintf( esc_html__( 'Your cart from %s', 'wc-cart-pdf' ), get_bloginfo( 'name' ) ), $customer ); -
do_action_ref_array( 'wc_cart_pdf_modal_form_save', array( &$errors, &$customer ) ); -
apply_filters( 'wc_cart_pdf_mpdf_args', array( 'mode' => get_locale(), 'format' => 'A4', 'default_font' => 'dejavusans', 'tempDir' => apply_filters( 'wc_cart_pdf_temp_dir', get_temp_dir() ), ) ); -
apply_filters( 'wc_cart_pdf_stream_options', array( 'compress' => 1, 'Attachment' => 1, ) ); -
apply_filters( 'wc_cart_pdf_temp_dir', get_temp_dir() ); -
apply_filters( 'wc_cart_pdf_unique_increment_string', sprintf( '%04d', $pdf_incrementer ) . '<br>', $pdf_incrementer ); -
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key ); -
woocommerce_cart_item_backorder_notification
filter Used by 49 plugins → Copy link Customise this hookapply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'wc-cart-pdf' ) . '</p>', $product_id ); -
apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image( array( apply_filters( 'wc_cart_pdf_thumbnail_width', 60 ), apply_filters( 'wc_cart_pdf_thumbnail_height', 60 ) ), array( 'width' => apply_filters( 'wc_cart_pdf_thumbnail_width', 60 ), 'height' => apply_filters( 'wc_cart_pdf_thumbnail_height', 60 ), ) ), $cart_item, $cart_item_key ); -
apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ); -
woocommerce_cart_totals_after_order_total
action Used by 18 plugins → Copy link Customise this hookdo_action( 'woocommerce_cart_totals_after_order_total' ); -
woocommerce_cart_totals_before_order_total
action Used by 18 plugins → Copy link Customise this hookdo_action( 'woocommerce_cart_totals_before_order_total' );
Generated from Cart PDF for WooCommerce's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.
Done for you
Rather have it built for you?
Tell us what should change and we’ll write and test the code using these hooks.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin customisation
from $149
New features or changed behaviour, without editing the plugin’s files.
- Built as a companion plugin, so updates never wipe it
- Exact quote before we start
- Tested on staging, then deployed
Typical turnaround: 3–7 business days
Choose thisNot sure which fits? Describe what you need and we’ll suggest the simplest option.
Can't find the right hook?
We can build the customisation for you. Describe what you need: