From 554381866b7b825b206036290125cd4919578aba Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Sun, 7 Apr 2013 05:30:02 -0300 Subject: [PATCH 1/2] added $args in woocommerce_formatted_address_replacements filter --- classes/class-wc-countries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/class-wc-countries.php b/classes/class-wc-countries.php index 7763f60f3bb..ba12db39832 100644 --- a/classes/class-wc-countries.php +++ b/classes/class-wc-countries.php @@ -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 ); From 2aa712ef4afb0e856069b3344635d60c5ac5a58a Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Sun, 7 Apr 2013 05:31:21 -0300 Subject: [PATCH 2/2] added filters to format the address --- admin/woocommerce-admin-users.php | 8 ++++---- classes/class-wc-order.php | 10 +++++----- templates/myaccount/my-address.php | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/admin/woocommerce-admin-users.php b/admin/woocommerce-admin-users.php index 687391ac228..956a50d8dd6 100644 --- a/admin/woocommerce-admin-users.php +++ b/admin/woocommerce-admin-users.php @@ -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 ); diff --git a/classes/class-wc-order.php b/classes/class-wc-order.php index f98c378c543..07578c2f07e 100644 --- a/classes/class-wc-order.php +++ b/classes/class-wc-order.php @@ -294,8 +294,8 @@ class WC_Order { global $woocommerce; // Formatted Addresses - $address = array( - 'first_name' => $this->billing_first_name, + $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, 'address_1' => $this->billing_address_1, @@ -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 ); } diff --git a/templates/myaccount/my-address.php b/templates/myaccount/my-address.php index 5b92c097769..8525f9ab74b 100644 --- a/templates/myaccount/my-address.php +++ b/templates/myaccount/my-address.php @@ -46,7 +46,7 @@ $col = 1;
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 );