wc_edit_address_i18n

Get the edit address slug translation.

Description

(string) wc_edit_address_i18n( (string) $id, (bool) $flip = false ); 

Returns (string)

Address slug i18n.

Parameters (2)

0. $id (string)
Address ID.
1. $flip — Optional. (bool) => false
Flip the array to make it possible to retrieve the values **from both sides.

Usage

  1. if ( !function_exists( 'wc_edit_address_i18n' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-account-functions.php'; 
  3.  
  4. // Address ID. 
  5. $id = ''; 
  6.  
  7. // Flip the array to make it possible to retrieve the values **from both sides. 
  8. $flip = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wc_edit_address_i18n($id, $flip); 
  12.  

Defined (1)

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

/includes/wc-account-functions.php  
  1. function wc_edit_address_i18n( $id, $flip = false ) { 
  2. $slugs = apply_filters( 'woocommerce_edit_address_slugs', array( 
  3. 'billing' => sanitize_title( _x( 'billing', 'edit-address-slug', woocommerce ) ),  
  4. 'shipping' => sanitize_title( _x( 'shipping', 'edit-address-slug', woocommerce ) ),  
  5. ) ); 
  6.  
  7. if ( $flip ) { 
  8. $slugs = array_flip( $slugs ); 
  9.  
  10. if ( ! isset( $slugs[ $id ] ) ) { 
  11. return $id; 
  12.  
  13. return $slugs[ $id ];