Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Alter shipping address
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