Notices if WP_DEBUG is enabled
-
It throws notices if the variable is not found: from 139 to 144: Id recomend update this code:
public function woocommerce_formatted_address_replacements( $replace, $args) { extract( $args ); return $replace += array( '{company_number}' => $company_number == '' ? '' : __('Company number: ', 'custom-account-fields') . $company_number, '{vat_number}' => $vat_number == '' ? '' : __('VAT number: ', 'custom-account-fields') . $vat_number, '{vat_number_2}' => $vat_number_2 == '' ? '' : __('VAT number 2: ', 'custom-account-fields') . $vat_number_2, '{company_number_upper}' => strtoupper($company_number == '' ? '' : __('Company number: ', 'custom-account-fields') . $company_number), '{vat_number_upper}' => strtoupper($vat_number == '' ? '' : __('VAT number: ', 'custom-account-fields') . $vat_number), '{vat_number_upper_2}' => strtoupper($vat_number_2 == '' ? '' : __('VAT number 2: ', 'custom-account-fields') . $vat_number_2), ); }to
public function woocommerce_formatted_address_replacements( $replace, $args) { return $replace += array( '{company_number}' => isset($args['company_number']) ? __('Company number: ', 'custom-account-fields') .$args['company_number'] : '', '{vat_number}' => isset($args['vat_number']) ? __('VAT number: ', 'custom-account-fields') . $args['vat_number'] : '', '{vat_number_2}' => isset($args['vat_number_2']) ? __('VAT number 2: ', 'custom-account-fields') . $args['vat_number_2'] :'', '{company_number_upper}' => strtoupper(isset($args['company_number']) ?__('Company number: ', 'custom-account-fields') . $args['company_number'] : '' ), '{vat_number_upper}' => strtoupper(isset($args['vat_number']) ? __('VAT number: ', 'custom-account-fields') . $args['vat_number'] : ''), '{vat_number_upper_2}' => strtoupper(isset($args['vat_number_2']) ? __('VAT number 2: ', 'custom-account-fields') . $args['vat_number_2'] : '') , ); }I also recomend to remove the extract function cause here it is not the best idea.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Notices if WP_DEBUG is enabled’ is closed to new replies.