public
Last active

WooCommerce - Override billing fields

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );
 
function custom_woocommerce_billing_fields( $fields ) {
 
// Over-ride a single label
$fields['billing_first_name']['label'] = 'Your label';
// Over-ride a single required value
$fields['billing_first_name']['required'] = false;
 
// Over-ride the entire thing
$fields['billing_postcode'] = array(
'label' => __('Postcode', 'woothemes'),
'placeholder' => __('Postcode', 'woothemes'),
'required' => true,
'class' => array('form-row-last update_totals_on_change')
);
 
/**
* You can over-ride - 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
*/
return $fields;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.