woocommerce_customer_meta_fields

Initialize the customer actions.

Description

(array) apply_filters( 'woocommerce_customer_meta_fields', (callback) $array ); 

Returns (array)

Fields to display which are filtered through woocommerce_customer_meta_fields before being returned

Parameters (1)

0. $array — Optional. (callback) => array( 'billing' => array( 'title' => __( 'Customer billing address', 'woocommerce' ), 'fields' => array( 'billing_first_name' => array( 'label' => __( 'First name', 'woocommerce' ), 'description' => '', ), 'billing_last_name' => array( 'label' => __( 'Last name', 'woocommerce' ), 'description' => '', ), 'billing_company' => array( 'label' => __( 'Company', 'woocommerce' ), 'description' => '', ), 'billing_address_1' => array( 'label' => __( 'Address line 1', 'woocommerce' ), 'description' => '', ), 'billing_address_2' => array( 'label' => __( 'Address line 2', 'woocommerce' ), 'description' => '', ), 'billing_city' => array( 'label' => __( 'City', 'woocommerce' ), 'description' => '', ), 'billing_postcode' => array( 'label' => __( 'Postcode / ZIP', 'woocommerce' ), 'description' => '', ), 'billing_country' => array( 'label' => __( 'Country', 'woocommerce' ), 'description' => '', 'class' => 'js_field-country', 'type' => 'select', 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(), ), 'billing_state' => array( 'label' => __( 'State / County', 'woocommerce' ), 'description' => __( 'State / County or state code', 'woocommerce' ), 'class' => 'js_field-state', ), 'billing_phone' => array( 'label' => __( 'Phone', 'woocommerce' ), 'description' => '', ), 'billing_email' => array( 'label' => __( 'Email address', 'woocommerce' ), 'description' => '', ), ), ), 'shipping' => array( 'title' => __( 'Customer shipping address', 'woocommerce' ), 'fields' => array( 'shipping_first_name' => array( 'label' => __( 'First name', 'woocommerce' ), 'description' => '', ), 'shipping_last_name' => array( 'label' => __( 'Last name', 'woocommerce' ), 'description' => '', ), 'shipping_company' => array( 'label' => __( 'Company', 'woocommerce' ), 'description' => '', ), 'shipping_address_1' => array( 'label' => __( 'Address line 1', 'woocommerce' ), 'description' => '', ), 'shipping_address_2' => array( 'label' => __( 'Address line 2', 'woocommerce' ), 'description' => '', ), 'shipping_city' => array( 'label' => __( 'City', 'woocommerce' ), 'description' => '', ), 'shipping_postcode' => array( 'label' => __( 'Postcode / ZIP', 'woocommerce' ), 'description' => '', ), 'shipping_country' => array( 'label' => __( 'Country', 'woocommerce' ), 'description' => '', 'class' => 'js_field-country', 'type' => 'select', 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(), ), 'shipping_state' => array( 'label' => __( 'State / County', 'woocommerce' ), 'description' => __( 'State / County or state code', 'woocommerce' ), 'class' => 'js_field-state', ), ), ), )
The array.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'woocommerce_customer_meta_fields', $array ); 
  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_customer_meta_fields callback 
  2. function filter_woocommerce_customer_meta_fields( $array ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_customer_meta_fields', 'filter_woocommerce_customer_meta_fields', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_customer_meta_fields', 'filter_woocommerce_customer_meta_fields', 10, 1 ); 

Defined (1)

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

/includes/admin/class-wc-admin-profile.php  
  1. $show_fields = apply_filters('woocommerce_customer_meta_fields', array(