Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 119748

Henry on "[WooCommerce] Remove fields on Edit Address"

$
0
0

Put this into your theme's functions.php

add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );

function custom_woocommerce_billing_fields( $fields ) {

   $fields['billing_first_name']	= array(
      'label'          => __('Name', 'woothemes'),
      'placeholder'    => __('Name', 'woothemes'),
      'required'       => true,
      'class'          => array('billing-first-name')
   );

   $fields['billing_phone']	= array(
      'label'          => __('Phone', 'woothemes'),
      'placeholder'    => __('Phone', 'woothemes'),
      'required'       => false,
      'class'          => array('billing-phone')
   );

 return $fields;
}

As you can see this allows you to change the billing address fields. My code example above sets the label, placeholder text, required, and class for both the first name and phone fields. You can do the same for:

billing_first_name, billing_last_name, billing_company, billing_address_1, billing_address_2, billing_city, billing_postcode, billing_country, billing_state, billing_email, billing_phone

Source: https://gist.github.com/1860056


Viewing all articles
Browse latest Browse all 119748

Trending Articles