Skip to content

Instantly share code, notes, and snippets.

@vishalbasnet23
Created October 10, 2014 06:44
Show Gist options
  • Save vishalbasnet23/6f029666894ad12894e0 to your computer and use it in GitHub Desktop.
Save vishalbasnet23/6f029666894ad12894e0 to your computer and use it in GitHub Desktop.
Override filter for woocommerce checkout fields
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
$fields['billing']['billing_city']['label'] = 'City';
$fields['billing']['billing_phone']['required'] = false;
$fields['order']['order_comments']['placeholder'] = 'My new placeholder';
//removing fields
unset($fields['order']['order_comments']);
//adding custom fields
$fields['shipping']['shipping_phone'] = array(
'label' => __('Phone', 'woocommerce'),
'placeholder' => _x('Phone', 'placeholder', 'woocommerce'),
'required' => false,
'class' => array('form-row-wide'),
'clear' => true
);
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment