public function get_formatted_shipping_address() {
if ( ! $this->formatted_shipping_address ) {
if ( $this->shipping_address_1 || $this->shipping_address_2 ) {
// Formatted Addresses
$address = apply_filters( 'woocommerce_order_formatted_shipping_address', array(
'first_name' => $this->shipping_first_name,
'last_name' => $this->shipping_last_name,
'company' => $this->shipping_company,
'address_1' => $this->shipping_address_1,
'address_2' => $this->shipping_address_2,
'city' => $this->shipping_city,
'state' => $this->shipping_state,
'postcode' => $this->shipping_postcode,
'country' => $this->shipping_country
), $this );
$this->formatted_shipping_address = WC()->countries->get_formatted_address( $address );
}
}
return $this->formatted_shipping_address;
}
'first_name' => 'ФИО - '.$this->shipping_first_name,
add_filter( 'woocommerce_order_formatted_shipping_address' , 'woo_custom_order_formatted_shipping_address',10, 2 );
/**
* woo_custom_order_formatted_shipping_address
*
* @access public
* @since 1.0
* @return void
*/
function woo_custom_order_formatted_shipping_address($address, $args) {
$address = array(
'first_name' => 'ФИО - '.$args->shipping_first_name,
'last_name' => $args->shipping_last_name,
'company' => $args->shipping_company,
'address_1' => $args->shipping_address_1,
'address_2' => $args->shipping_address_2,
'city' => $args->shipping_city,
'state' => $args->shipping_state,
'postcode' => $args->shipping_postcode,
'country' => $args->shipping_country
);
return $address;
}
'first_name' => 'ФИО - '.$this->shipping_first_name,
add_filter( 'woocommerce_order_formatted_billing_address' , 'woo_custom_order_formatted_billing_address',10, 2 );
/**
* woo_custom_order_formatted_shipping_address
*
* @access public
* @since 1.0
* @return void
*/
function woo_custom_order_formatted_billing_address($address, $args) {
$address = array(
'first_name' => 'ФИО - '.$args->billing_first_name,
'last_name' => $args->billing_last_name,
'company' => 'Дом - '.$args->billing_company,
'address_1' => 'Улица - '.$args->billing_address_1,
'address_2' => 'Примечание к заказу - '.$args->billing_address_2,
'city' => 'Квартира/Офис - '.$args->billing_city,
'state' => 'Подъезд - '.$args->billing_state,
'postcode' => 'Этаж - '.$args->billing_postcode,
'country' => $args->billing_country
);
return $address;
}