Created
August 28, 2024 08:55
-
-
Save webtoffee-git/3bcad17af60a74d40a8eb8553229f156 to your computer and use it in GitHub Desktop.
Code for customizing the print and download button labels on the My Account page - By WebToffee (WooCommerce PDF Invoices, Packing Slips and Credit Notes Plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Do not copy this line of code | |
add_filter('wt_pklist_alter_document_button_label', 'alter_document_btn_label', 10, 4); | |
function alter_document_btn_label($label, $action, $where, $template_type) { | |
if ( 'invoice' === $template_type ) { | |
// Order details page | |
if ( 'my_account_order_details' === $where ) { | |
// Customize the print invoice button on the order details page | |
if ( 'print' === $action ) { | |
$label = __("Print Invoice order details", "print-invoices-packing-slip-labels-for-woocommerce"); | |
// Customize the download invoice button on the order details page | |
} elseif ( 'download' === $action ) { | |
$label = __("Download Invoice order details", "print-invoices-packing-slip-labels-for-woocommerce"); | |
} | |
// Order listing page | |
} elseif ( 'my_account_order_listing' === $where ) { | |
// Customize the print invoice button on the order listing page | |
if ( 'print' === $action ) { | |
$label = __("Print Invoice order listing", "print-invoices-packing-slip-labels-for-woocommerce"); | |
// Customize the download invoice button on the order listing page | |
} elseif ( 'download' === $action ) { | |
$label = __("Download Invoice order listing", "print-invoices-packing-slip-labels-for-woocommerce"); | |
} | |
// Order email | |
} elseif ( 'email' === $where ) { | |
// Customize the print invoice button on the order email | |
if ( 'print' === $action ) { | |
$label = __("Print Invoice email", "print-invoices-packing-slip-labels-for-woocommerce"); | |
} | |
} | |
} | |
return $label; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment