Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Created October 22, 2021 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webtoffee-git/c51ea57feb815f6506062dd475a7159e to your computer and use it in GitHub Desktop.
Save webtoffee-git/c51ea57feb815f6506062dd475a7159e to your computer and use it in GitHub Desktop.
<?php //do not copy this line
add_filter('wf_pklist_alter_shipping_address','wf_pklist_alter_address_formats',10,3);
add_filter('wf_pklist_alter_billing_address','wf_pklist_alter_address_formats',10,3);
add_filter('wf_pklist_alter_shipping_from_address','wf_pklist_alter_address_formats',10,3);
function wf_pklist_alter_address_formats($address, $template_type, $order)
{
if($template_type=='invoice')
{
$arr=array($address['country'], $address['postcode'],$address['city'],isset($address['address_1'])?$address['address_1']:$address['address_line1'],isset($address['address_2'])?$address['address_2']:$address['address_line2']);
//you can alter separator <br/> in below statement
$address['city']=implode($arr, "<br/>");
unset($address['postcode']);
unset($address['state']);
unset($address['country']);
unset($address['address_1']);
unset($address['address_2']);
unset($address['address_line1']);
unset($address['address_line2']);
}
return $address;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment