Merge pull request #2895 from claudiosmweb/address_filters

Added new filters to format the address
This commit is contained in:
Mike Jolley 2013-04-08 12:35:33 -07:00
commit de3cce85dc
4 changed files with 12 additions and 12 deletions

View File

@ -72,7 +72,7 @@ function woocommerce_user_column_values( $value, $column_name, $user_id ) {
break;
case "woocommerce_billing_address" :
$address = array(
$address = apply_filters( 'woocommerce_user_column_billing_address', array(
'first_name' => get_user_meta( $user_id, 'billing_first_name', true ),
'last_name' => get_user_meta( $user_id, 'billing_last_name', true ),
'company' => get_user_meta( $user_id, 'billing_company', true ),
@ -82,7 +82,7 @@ function woocommerce_user_column_values( $value, $column_name, $user_id ) {
'state' => get_user_meta( $user_id, 'billing_state', true ),
'postcode' => get_user_meta( $user_id, 'billing_postcode', true ),
'country' => get_user_meta( $user_id, 'billing_country', true )
);
), $user_id );
$formatted_address = $woocommerce->countries->get_formatted_address( $address );
@ -94,7 +94,7 @@ function woocommerce_user_column_values( $value, $column_name, $user_id ) {
$value = wpautop( $value );
break;
case "woocommerce_shipping_address" :
$address = array(
$address = apply_filters( 'woocommerce_user_column_shipping_address', array(
'first_name' => get_user_meta( $user_id, 'shipping_first_name', true ),
'last_name' => get_user_meta( $user_id, 'shipping_last_name', true ),
'company' => get_user_meta( $user_id, 'shipping_company', true ),
@ -104,7 +104,7 @@ function woocommerce_user_column_values( $value, $column_name, $user_id ) {
'state' => get_user_meta( $user_id, 'shipping_state', true ),
'postcode' => get_user_meta( $user_id, 'shipping_postcode', true ),
'country' => get_user_meta( $user_id, 'shipping_country', true )
);
), $user_id );
$formatted_address = $woocommerce->countries->get_formatted_address( $address );

View File

@ -647,7 +647,7 @@ class WC_Countries {
'{state_upper}' => strtoupper( $full_state ),
'{postcode_upper}' => strtoupper( $postcode ),
'{country_upper}' => strtoupper( $full_country ),
) ) ;
), $args ) ;
$replace = array_map( 'esc_html', $replace );

View File

@ -294,7 +294,7 @@ class WC_Order {
global $woocommerce;
// Formatted Addresses
$address = array(
$address = apply_filters( 'woocommerce_order_formatted_billing_address', array(
'first_name' => $this->billing_first_name,
'last_name' => $this->billing_last_name,
'company' => $this->billing_company,
@ -304,7 +304,7 @@ class WC_Order {
'state' => $this->billing_state,
'postcode' => $this->billing_postcode,
'country' => $this->billing_country
);
), $this );
$this->formatted_billing_address = $woocommerce->countries->get_formatted_address( $address );
}
@ -347,7 +347,7 @@ class WC_Order {
global $woocommerce;
// Formatted Addresses
$address = array(
$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,
@ -357,7 +357,7 @@ class WC_Order {
'state' => $this->shipping_state,
'postcode' => $this->shipping_postcode,
'country' => $this->shipping_country
);
), $this );
$this->formatted_shipping_address = $woocommerce->countries->get_formatted_address( $address );
}

View File

@ -46,7 +46,7 @@ $col = 1;
</header>
<address>
<?php
$address = array(
$address = apply_filters( 'woocommerce_my_address_formatted_address', array(
'first_name' => get_user_meta( $customer_id, $name . '_first_name', true ),
'last_name' => get_user_meta( $customer_id, $name . '_last_name', true ),
'company' => get_user_meta( $customer_id, $name . '_company', true ),
@ -56,7 +56,7 @@ $col = 1;
'state' => get_user_meta( $customer_id, $name . '_state', true ),
'postcode' => get_user_meta( $customer_id, $name . '_postcode', true ),
'country' => get_user_meta( $customer_id, $name . '_country', true )
);
), $customer_id, $name );
$formatted_address = $woocommerce->countries->get_formatted_address( $address );