Created
January 14, 2022 13:48
-
-
Save webtoffee-git/d45f635894d34191e04f58209cc15f64 to your computer and use it in GitHub Desktop.
Sample code to alter the payment method text [https://wordpress.org/plugins/print-invoices-packing-slip-labels-for-woocommerce/]
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 | |
add_filter('wf_pklist_alter_find_replace', 'wt_pklist_add_payment_method', 10, 6); | |
function wt_pklist_add_payment_method($find_replace, $template_type, $order, $box_packing, $order_package, $html) | |
{ | |
if($template_type=='invoice') | |
{ | |
$paymethod_title=(WC()->version < '2.7.0') ? $order->payment_method_title : $order->get_payment_method_title(); | |
if(!empty($paymethod_title)) | |
{ | |
$find_replace['[wfte_product_table_payment_method]']=__($paymethod_title); | |
} | |
else | |
{ | |
$find_replace['[wfte_product_table_payment_method]']=''; | |
} | |
} | |
return $find_replace; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment