Matt
@ecartz ,
O.K. I applied your suggestion with the following additional changes:
Code: Select all
$address = [
'address_line1' => $GLOBALS['customer_data']->get('street_address', $order->billing) ?? '',
'address_city' => $GLOBALS['customer_data']->get('city', $order->billing) ?? '',
'address_zip' => $GLOBALS['customer_data']->get('postcode', $order->billing) ?? '',
'address_state' => $GLOBALS['customer_data']->get('state', $order->billing) ?? '',
'address_country' => $GLOBALS['customer_data']->get('country_iso_code_2', $order->billing) ?? '',
];
foreach ($address as $k => $v) {
$content .= '<input type="hidden" id="' . Text::output($k) . '" value="' . Text::output($v) . '" />';
}
1. I replaced "tep_output_string" by "Text::output"
2. I catched all customer data with empty string if null. In the extreme case, if a shop for example only sells downloadable products, they may just use customer name and e-mail.
3. I removed tep_output_string/Text::output in the array built, its already used in the output loop and $address is not used elsewhere.
Or maybe I should keep "tep_output_string" for backwards compatibility and avoid an additional version?
Does it look O.K. to you?
Thank you!