This document provides a comprehensive list of all hooks and filters available within the plugin. It serves as a resource for developers aiming to enhance the plugin’s functionality.
How can I create an invoice on the checkout page when the “Print” button is clicked?
Hook
wcdn_theme_print_button_template_type_arbitrary
Usage:
add_filter( 'wcdn_theme_print_button_template_type_arbitrary', 'change_print_invoice', 10 );
Example:
/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function change_print_invoice( $order ) {
$type = 'invoice';
return $type;
}
add_filter( 'wcdn_theme_print_button_template_type_arbitrary', 'change_print_invoice', 10 );
How to change the font of the invoice and delivery note?
Hook
wcdn_head
Usage:
add_action( 'wcdn_head', 'example_serif_font_and_large_address', 20 );
Example:
/**
* Add this code snippet in the "functions.php" file of your currently active theme.
*/
function example_serif_font_and_large_address() {
?>
<style>
#page {
font-size: 1em;
font-family: Georgia, serif;
}
.order-addresses address {
font-size: 2.5em;
line-height: 125%;
}
</style>
<?php
}
add_action( 'wcdn_head', 'example_serif_font_and_large_address', 20 );
How can I hide the prices on the delivery notes?
Hook
wcdn_head
Usage
add_action( 'wcdn_head', 'example_price_free_delivery_note', 20 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
*/
function example_price_free_delivery_note() {
?>
<style>
.delivery-note .head-item-price,
.delivery-note .head-price,
.delivery-note .product-item-price,
.delivery-note .product-price,
.delivery-note .order-items tfoot {
display: none;
}
.delivery-note .head-name,
.delivery-note .product-name {
width: 50%;
}
.delivery-note .head-quantity,
.delivery-note .product-quantity {
width: 50%;
}
.delivery-note .order-items tbody tr:last-child {
border-bottom: 0.24em solid black;
}
</style>
<?php
}
add_action( 'wcdn_head', 'example_price_free_delivery_note', 20 );
How do I style the receipt when POS is used?
Hook
wcdn_head
Usage
add_action( 'wcdn_head', 'example_price_free_delivery_note', 20 );
Example:/
/**
* Add this code snippet in the functions.php file of your currently active theme.
*/
function example_address_free_receipt() {
?>
<style>
.content {
padding: 4% 6%;
}
.company-address,
.order-addresses {
display: none;
}
.order-info li span {
display: inline-block;
float: right;
}
.order-thanks {
margin-left: inherit;
}
</style>
<?php
}
add_action( 'wcdn_head', 'example_address_free_receipt', 20 );
How can I remove a field from the Order info section?
Hook
wcdn_order_info_fields
Usage
add_filter( 'wcdn_order_info_fields', 'example_removed_payment_method' );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example that removes the 'Payment Method' field.
*/
function example_removed_payment_method( $fields ) {
unset( $fields['payment_method'] );
return $fields;
}
add_filter( 'wcdn_order_info_fields', 'example_removed_payment_method' );
How do I add additional fields to the Order info section?
Hook
wcdn_order_info_fields
Usage:
add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );
Example:
/**
* Add this code snippet in functions.php file of your currently active theme.
* An example that adds a 'VAT' and 'Customer Number' field to the end of the list.
*/
function example_custom_order_fields( $fields, $order ) {
$new_fields = array();
if( get_post_meta( $order->id, 'your_meta_field_name', true ) ) {
$new_fields['your_meta_field_name'] = array(
'label' => 'VAT',
'value' => get_post_meta( $order->id, 'your_meta_field_name', true )
);
}
if( get_post_meta( $order->id, 'your_meta_field_name', true ) ) {
$new_fields['your_meta_field_name'] = array(
'label' => 'Customer Number',
'value' => get_post_meta( $order->id, 'your_meta_field_name', true )
);
}
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );
How can I include the product image in the invoice and delivery note?
Hook
wcdn_order_item_before
Usage:
add_action( 'wcdn_order_item_before', 'example_product_image' );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example that adds a 40px large product image.
*/
function example_product_image( $product ) {
if( isset( $product->id ) && has_post_thumbnail( $product->id ) ) {
echo get_the_post_thumbnail( $product->id, array( 40, 40 ) );
}
}
add_action( 'wcdn_order_item_before', 'example_product_image' );
How can I add the variation image to the invoice and delivery note?
Hook
wcdn_order_item_before
Usage:
add_action( 'wcdn_order_item_before', 'example_product_image' );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example that adds a 90*70 px large product image.
*/
function example_product_image( $product ) {
if ( isset( $product->id ) ) {
$variation_image_id = $product->get_image_id();
echo wp_get_attachment_image( $variation_image_id, array( '90', '70' ) );
}
}
add_action( 'wcdn_order_item_before', 'example_product_image' );
How to hide the child products in Composite Products?
Hook
wcdn_order_item_product
Usage:
add_filter( 'wcdn_order_item_product', 'print_invoice_order_item_visible', 10, 2 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to hide the child products in Composite Products.
*/
function print_invoice_order_item_visible( $order, $item ) {
if ( ! empty( $item[ 'composite_parent' ] ) ) {
return false;
}
return $order;
}
add_filter( 'wcdn_order_item_product', 'print_invoice_order_item_visible', 10, 2 );
How can I change the options’ name in the bulk dropdown action on the WooCommerce Orders page?
Hook
wcdn_change_text_of_print_receipt_in_bulk_option
Usage:
add_filter('wcdn_change_text_of_print_receipt_in_bulk_option','change_text_of_print_receipt_in_bulk_option');
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to change the Print invoice option name in the bulk dropdown action.
*/
function change_text_of_print_invoice_in_bulk_option(){
return "Print eBAY";
}
add_filter('wcdn_change_text_of_print_invoice_in_bulk_option','change_text_of_print_invoice_in_bulk_option');
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to change the Print Delivery Note option name in the bulk dropdown action.
*/
function change_text_of_print_delivery_note_in_bulk_option(){
return "Print eBAY";
}
add_filter('wcdn_change_text_of_print_delivery_note_in_bulk_option','change_text_of_print_delivery_note_in_bulk_option');
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to change the Print Receipt option name in the bulk dropdown action.
*/
function change_text_of_print_receipt_in_bulk_option(){
return "Print eBAY";
}
add_filter('wcdn_change_text_of_print_receipt_in_bulk_option','change_text_of_print_receipt_in_bulk_option');
How to add Admin notes in the invoices?
Hook
wcdn_order_info_fields
Usage:
add_filter( 'wcdn_order_info_fields', 'wcdn_add_admin_notes', 10, 2 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to add the admin notes in the invoice.
*/
function wcdn_add_admin_notes( $fields, $order ) {
$new_fields = array();
$admin_order_notes = wc_get_order_notes( array(
'order_id' => $order->get_id(),
) );
foreach( $admin_order_notes as $admin_order_note ) {
if ( 'admin' === $admin_order_note->added_by ) {
$admin_notes[] = $admin_order_note->content;
}
}
if ( $admin_notes ) {
$new_fields['admin_note'] = array(
'label' => 'Admin Note',
'value' => implode(' ' , $admin_notes )
);
}
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', 'wcdn_add_admin_notes', 10, 2 );
How can I modify the billing/shipping address on the invoices?
Hook
wcdn_address_shipping
Usage:
add_filter( 'wcdn_address_shipping', 'wcdn_shipping_address', PHP_INT_MAX, 2 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to show the payment method below the billing/shipping address.
*/
function wcdn_billing_address( $billing_address, $order ) {
$extra_payment_method_field = $order->get_payment_method();
$billing_address = $billing_address . '' . $extra_payment_method_field;
return $billing_address;
}
add_filter( 'wcdn_address_billing', 'wcdn_billing_address', PHP_INT_MAX, 2 );
function wcdn_shipping_address( $shipping_address, $order ) {
$extra_payment_method_field = $order->get_payment_method();
$shipping_address = $shipping_address . '' . $extra_payment_method_field;
return $shipping_address;
}
add_filter( 'wcdn_address_shipping', 'wcdn_shipping_address', PHP_INT_MAX, 2 );
How to remove product metadata from the invoices?
Hook
wcdn_product_meta_data
Usage:
add_filter( 'wcdn_product_meta_data', 'example_remove_meta_field' );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* An example to remove the text metadata field in the invoice.
*/
function example_remove_meta_field( $fields ) {
unset( $fields['Text'] );
return $fields;
}
add_filter( 'wcdn_product_meta_data', 'example_remove_meta_field' );
How can I create different content based on the type of print?
Hook
wcdn_product_meta_data
Usage:
add_filter( 'wcdn_product_meta_data', 'example_remove_meta_field' );
Example:
function example_remove_meta_field() {
$template_type = wcdn_get_template_type();
switch ( $template_type ) {
case 'invoice':
// code for the customs invoice will go here.
// exit();
break;
case 'delivery-note':
// code for the custom delivery note will go here.
// exit();
break;
case 'receipt':
// code for the custom receipt will go here.
// exit();
break;
default:
# code...
break;
}
}
add_action( 'wcdn_product_meta_data', 'example_remove_meta_field' );
How to remove the email entry from the receipt printout?
Hook
wcdn_order_info_fields
Usage:
add_filter( 'wcdn_order_info_fields', 'removed_billing_email' );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* Removing the email entry from the receipt printout.
*/
function removed_billing_email( $fields ){
if ( 'receipt' === wcdn_get_template_type() ) {
unset( $fields['billing_email'] );
return $fields;
} else {
return $fields;
}
}
add_filter( 'wcdn_order_info_fields', 'removed_billing_email' );
How can I remove the title of the invoice in the invoice template?
Hook
wcdn_document_title
Usage:
add_filter( 'wcdn_document_title', 'hide_print_invoice_title' );
Example:
/**
* Add this code snippet in functions. php file of your currently active theme.
* Hide invoice title in invoice print.
* For delivery note templete change 'invoice' to 'delivery note'
*/
function hide_print_invoice_title( $title ) {
if ( strtolower( $title ) === 'invoice' ) {
return '';
}
return $title;
}
add_filter( 'wcdn_document_title', 'hide_print_invoice_title' );
How do I show custom text on the printed invoice when the Local Pickup shipping method is selected instead of the shipping address?
Hook
wcdn_address_shipping
Usage:
add_filter( 'wcdn_address_shipping', 'custom_modify_shipping_address', 10, 2 );
Example:
/**
* Add this code snippet in functions. php file of your currently active theme.
* When shipping method local pickup is selected, show custom text on print invoice instead shipping address.
*/
function custom_modify_shipping_address( $formatted_shipping_address, $order ) {
$chosen_shipping_methods = $order->get_shipping_methods();
foreach ( $chosen_shipping_methods as $chosen_shipping_method ) {
if ( strpos( $chosen_shipping_method, 'local_pickup' ) !== false ) {
return 'Add your custom note'; // add your custome note here.
}
}
return $formatted_shipping_address;
}
add_filter( 'wcdn_address_shipping', 'custom_modify_shipping_address', 10, 2 );
How can I remove the Shop name from the invoice?
Hook
wcdn_company_name
Usage:
add_filter('wcdn_company_name', 'remove_company_name_filter', 10, 1);
Example:
/**
* Add this code snippet in functions.php file of your currently active theme.
* This will remove the shop name in the invoice.
*/
function remove_company_name_filter( $name ) {
return '';
}
add_filter('wcdn_company_name', 'remove_company_name_filter', 10, 1);
How can I display the Order ID in the shop area?
Hook
wcdn_after_branding
Usage:
add_action( 'wcdn_after_branding', 'show_order_id', 10, 1 );
Example:
/**
* Add this code snippet in functions.php file of your currently active theme.
* This will show the Order ID at the shop area.
*/
function show_order_id( $order ) {
$order_id = $order->get_id();
echo 'Order ID: ' . $order_id . '';
}
add_action( 'wcdn_after_branding', 'show_order_id', 10, 1 );
How to add a ‘Billing First and Last Name’ fields to the end of the Order info list?
Hook
wcdn_order_info_fields
Usage:
add_filter( 'wcdn_order_info_fields', 'add_billing_first_last_name', 10, 2 );
Example:
/**
* Add this code snippet in functions.php file of your currently active theme.
* This adds a 'Billing First and Last name ' field to the end of the order info list.
*/
function add_billing_first_last_name( $fields, $order ) {
$new_fields = array();
$billing_first_name = $order->get_billing_first_name();
$billing_last_name = $order->get_billing_last_name();
$new_fields ['billing_name'] = array(
'label' => 'Billing Name',
'value' => $billing_first_name . ' ' . $billing_last_name,
);
return array_merge( $fields, $new_fields );
}
add_filter( 'wcdn_order_info_fields', 'add_billing_first_last_name', 10, 2 );
How can I modify the customer note title in the printed invoice?
Hook
gettext
Usage:
add_filter( 'gettext', 'modify_customer_note_title', 20, 3 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* Modified your Customer Note title in print invoice.
*/
function modify_customer_note_title( $translated_text, $text, $domain ) {
if ( 'woocommerce-delivery-notes' === $domain ) {
if ( 'Customer Note' === $text ) {
// Replace with your desired title.
$translated_text = 'New Customer Note Title';
}
}
return $translated_text;
}
add_filter( 'gettext', 'modify_customer_note_title', 20, 3 );
How to remove the shipping method from the shipping price display?
Hook
woocommerce_order_shipping_to_display_shipped_via
Usage:
add_filter( 'woocommerce_order_shipping_to_display_shipped_via', 'custom_shipping_to_display_shipped_via', 10, 2 );
Example:
/**
* Add this code snippet in the 'functions.php' file of your currently active theme.
* Removing the shipping Via method in shipping price.
* This is WC filter, so it will hide the method in order table.
*/
function custom_shipping_to_display_shipped_via( $shipping, $order ) {
// Modify the $shipping string to remove 'via' and the shipping method.
$shipping_method = $order->get_shipping_method();
$via_position = strpos( $shipping, 'via ' . $shipping_method );
if ( $via_position !== false ) {
$shipping_without_via = substr( $shipping, 0, $via_position );
$shipping_without_method = rtrim( $shipping_without_via, ' ' );
$shipping = $shipping_without_method;
}
return $shipping;
}
add_filter( 'woocommerce_order_shipping_to_display_shipped_via', 'custom_shipping_to_display_shipped_via', 10, 2 );
How can I change the text for “Print: Open print view in browser” in the email URL?
Hook
wcdn_print_view_in_browser_text_in_email
Usage:
add_filter( 'wcdn_print_view_in_browser_text_in_email', 'change_print_view_in_browser_text_in_email_function', 10, 2 );
Example:
/**
* Add this code snippet in the functions.php file of your currently active theme.
* This will change your Print: Text In email URl.
*/
function change_print_text_in_email_function( $text, $domain ) {
if ( 'Print:' === $text && 'woocommerce-delivery-notes' === $domain ) {
return 'Print Invoice/receipt:'; // Modified this with your Text. it will change the Print:.
}
return $text;
}
add_filter( 'wcdn_print_text_in_email', 'change_print_url_text_email_function', 10, 2 );
/**
* Add this code snippet in the functions.php file of your currently active theme.
* This will change Open print view in browser Text In email URl.
*/
function change_print_view_in_browser_text_in_email_function( $text, $domain ) {
if ( 'Open print view in browser' === $text && 'woocommerce-delivery-notes' === $domain ) {
return 'Open print Invoice/receipt view in browser'; // Modified this Text with your Text. It will changing Open print view in browser.
}
return $text;
}
add_filter( 'wcdn_print_view_in_browser_text_in_email', 'change_print_view_in_browser_text_in_email_function', 10, 2 );
How to add an extra image or logo to the receipt invoice?
Hook
wcdn_after_branding
Usage:
add_action( 'wcdn_after_branding','add_extra_image', 10, 2 );
Example:
add_action( 'wcdn_after_branding','add_extra_image', 10, 2 );
function add_extra_image() {
$template_type = wcdn_get_template_type();
if ($template_type === 'receipt' || $template_type === 'invoice') {
?>
<style>
/* when screen is less than 600px wide show mobile version and hide desktop */
@media ( max-width: 600px ) {
.extra-image-mobile .extra-image {
display: block;
}
.extra-image-mobile {
position:absolute;
opacity:1;
top: 17%;
left: 40%;
}
extra-image .extra-image-desktop {
display: none;
}
}
/*when screen is more than 800px wide show desktop version and hide mobile */
@media ( min-width: 800px ){
.extra-image-desktop {
position:absolute;
opacity:1;
left: 50%;
top: 20%;
}
.extra-image .extra-image-mobile {
display: none;
}
}
/* Print-specific styles, it will modified the PDF */
@media print {
.extra-image,
.extra-image-mobile,
.extra-image-desktop {
position: absolute !important; /* Use !important to ensure priority */
opacity: 1;
left: 50%;
top: 5%;
display: block !important; /* Use !important to ensure priority */
}
}
</style>
<div class="extra-image">
<img src="http://print-extra-issue.local/wp-content/uploads/2023/10/beanie-2.jpg" class="extra-image-desktop" width="100" height="100" alt="Stamp">
</div>
<?php
}
}
?php
}
add_action( 'wcdn_head', 'print_paper_resize', 10, 1 );
How can I hide the product name when the SKU is set?
Hook
wcdn_order_item_name
Usage:
add_filter( 'wcdn_order_item_name', 'custom_wcdn_order_item_name_filter', 10, 2 );
Example:
function custom_wcdn_order_item_name_filter( $product_name, $item ) {
// Check if SKU is set for the product
$product_id = $item['product_id'];
$product = wc_get_product( $product_id );
$sku = $product->get_sku();
if ( ! empty( $sku ) ) {
return '';
}
return $product_name;
}
add_filter( 'wcdn_order_item_name', 'custom_wcdn_order_item_name_filter', 10, 2 );
What code should I use to properly add fields to the order info section?
Hook
wcdn_order_item_name
Usage:
add_filter( 'wcdn_order_item_name', 'custom_wcdn_order_item_name_filter', 10, 2 );
Example:
function custom_order_info_fields( $fields, $order ) {
// Add your custom meta fields here
$custom_fields = array(
array(
'label' => 'ID:',
'value' => $order->get_meta('_billing_tckimlik_vergino', true),
),
);
// Merge the custom fields with the existing fields
$fields = array_merge( $fields, $custom_fields );
return $fields;
}
add_filter( 'wcdn_order_info_fields', 'custom_order_info_fields', 10, 2 );
How can I modify the Quantity title in the printed invoice, and is there a way to translate the text using this filter?
Hook
gettext
/**
* Add this code snippet in the functions.php file of your currently active theme.
* Modified your Quantity title in print invoice. any text can be translated using this filter.
*/
function modify_customer_note_title( $translated_text, $text, $domain ) {
if ( 'woocommerce-delivery-notes' === $domain ) {
if ( 'Quantity' === $text ) {
// Replace with your desired title.
$translated_text = 'Q';
}
}
return $translated_text;
}
add_filter( 'gettext', 'modify_customer_note_title', 20, 3 );
How to Override the Invoice Template in My Theme?
To override the print invoice template in your active theme, please follow these steps:
- Create a folder named “print-order” within the woocommerce directory of your currently active theme.
- Move all relevant files associated with the “print-order” into this new folder.
- Make the necessary modifications to those files as needed. For your reference, here is a screenshot:

How can I change the font size of the text in the PDF attached to the email?
Hook:
wcdn_head_pdf
Usage
add_action( ‘wcdn_head_pdf’, ‘my_customisation’, 10, 1 );
Example:
function my_customisations() {
?>
<style>
body {
font-size: 30px !important;
}
</style>
<?php
}
add_action( 'wcdn_head_pdf', 'my_customisations', 10, 1 );