Created
February 19, 2021 05:28
-
-
Save webtoffee-git/16e58d75ca3eba43f98f0dfadd242c5e to your computer and use it in GitHub Desktop.
Alter shipping address
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
add_filter('wf_pklist_alter_shipping_address', 'webtoffee_pklist_alter_shipping_address', 10, 3); | |
function webtoffee_pklist_alter_shipping_address( $shipping_address, $template_type, $order) | |
{ | |
if($template_type == 'invoice') | |
{ | |
$order_id = (WC()->version < '2.7.0') ? $order->id : $order->get_id(); | |
$house_no = get_post_meta($order_id, 'house_no', true); | |
$shipping_street =$order->get_shipping_address_2(); | |
$shipping_city=$order->get_shipping_city(); | |
$out=array( | |
'name'=>$shipping_address['first_name'].' '.$shipping_address['last_name'], | |
'house_no'=>__('House No: ').$house_no, | |
'town'=>__('Town/City: ').$shipping_city.', '.__('STREET:').$shipping_street, | |
'country'=>__('Country/Region: ').$shipping_address['country'], | |
); | |
$shipping_address=$out; | |
} | |
return $shipping_address; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment