woocommerce_formatted_address_replacements

The WooCommerce woocommerce formatted address replacements hook.

Description

apply_filters( 'woocommerce_formatted_address_replacements', (callback) $array, (unknown) $args ); 

Parameters (2)

0. $array — Optional. (callback) => array( '{first_name}' => $first_name, '{last_name}' => $last_name, '{name}' => $first_name . ' ' . $last_name, '{company}' => $company, '{address_1}' => $address_1, '{address_2}' => $address_2, '{city}' => $city, '{state}' => $full_state, '{postcode}' => $postcode, '{country}' => $full_country, '{first_name_upper}' => strtoupper( $first_name ), '{last_name_upper}' => strtoupper( $last_name ), '{name_upper}' => strtoupper( $first_name . ' ' . $last_name ), '{company_upper}' => strtoupper( $company ), '{address_1_upper}' => strtoupper( $address_1 ), '{address_2_upper}' => strtoupper( $address_2 ), '{city_upper}' => strtoupper( $city ), '{state_upper}' => strtoupper( $full_state ), '{state_code}' => strtoupper( $state ), '{postcode_upper}' => strtoupper( $postcode ), '{country_upper}' => strtoupper( $full_country ), )
The array.
1. $args (unknown)
The args.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'woocommerce_formatted_address_replacements', $array, $args ); 
  2.  
  3. if ( !empty( $array ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_formatted_address_replacements callback 
  2. function filter_woocommerce_formatted_address_replacements( $array, $args ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_formatted_address_replacements', 'filter_woocommerce_formatted_address_replacements', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_formatted_address_replacements', 'filter_woocommerce_formatted_address_replacements', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/class-wc-countries.php  
  1. $replace = array_map( 'esc_html', apply_filters( 'woocommerce_formatted_address_replacements', array(