Action Hooks Reference

Challan – WooCommerce pdf invoices & packing slips includes several actions & filter hooks where you can output order meta, product meta, or custom content. Below is the list of available action and filter hooks:

Action Hooks

Action Hooks Position Arguments
woo_invoice_custom_style Add CSS Style to Invoice $template 
(invoice or packing_slip)
woo_invoice_before_document The header of the Invoice template $order, $template
(invoice or packing_slip) 
woo_invoice_after_document Footer of the Invoice template $order, $template 
(invoice or packing_slip) 
woo_invoice_after_document_label After Invoice Title at the header $order, $template 
(invoice or packing_slip) 
woo_invoice_before_billing_address Before Billing or Shipping Address $order, $template 
(invoice or packing_slip) 
woo_invoice_after_billing_address After Billing or Shipping Address $order, $template 
(invoice or packing_slip) 
woo_invoice_before_order_data Before order details  $order, $template 
(invoice or packing_slip) 
woo_invoice_after_order_data After order details $order, $template 
(invoice or packing_slip) 
woo_invoice_before_product_list Before the product list table  $order, $template 
(invoice or packing_slip) 
woo_invoice_after_product_list After  the product list table $order, $template 
(invoice or packing_slip) 
woo_invoice_before_item_meta Before Product info $product, $order, $template 
(invoice or packing_slip) 
woo_invoice_after_item_meta After Product info $product, $order, $template 
(invoice or packing_slip) 
woo_invoice_before_customer_notes Before order note $order, $template 
(invoice or packing_slip) 
After order note $order, $template 
(invoice or packing_slip) 

Filter Hooks

Filter Hooks Arguments
woo_invoice_email_types      $email_types
woo_invoice_mpdf_settings    $mdpf_settings
woo_invoice_file_name        $filename, $template, $order_no
woo_invoice_pdf_font_data  $font_data, $template
woo_invoice_paper_size      $paper_size, $template
woo_invoice_store_logo  $logo_url
woo_invoice_seller_info $seller_address, $template
woo_invoice_billing_info $buyer_address, $order, $template
woo_invoice_shipping_info $shipping_address, $order, $template
woo_invoice_order_data $order_info, $template, $order_object
woo_invoice_order_number    $order_number, $template, $order_object
woo_invoice_order_date    $order_date, $template, $order_object
woo_invoice_invoice_number  $invoice_number, $template, $order_object
woo_invoice_product_data $products, $template, $order_object
woo_invoice_order_total $totals, $template, $order_object
woo_invoice_paid_stamp    $paid_stamp_url
woo_invoice_customer_notes   $customer_note, $template, $order_object
woo_invoice_footer_1 $content, $template, $order_object
woo_invoice_footer_2 $content, $template, $order_object

Example 1: Add order meta to order details section

add_action( 'woo_invoice_after_order_data', 'woo_invoice_delivery_date', 10, 2 );
function woo_invoice_delivery_date ($order,$template_type) {
    if ($template_type == 'invoice') {
        // get the delivery date from the order
        $delivery_date = $order->get_meta('delivery_date');
        // convert date according to WooCommerce/WordPress date format settings)
        $formatted_delivery_date = date_i18n( wc_date_format(), $delivery_date );
        <span>Delivery Date: <?php echo $formatted_delivery_date; ?></span>
Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.