Skip to content

Instantly share code, notes, and snippets.

@bhaskarkc
Forked from vishalbasnet23/override-checkout-fields
Last active August 29, 2015 14:19
Show Gist options
  • Save bhaskarkc/ebb44fa8e2a4e8b5a39d to your computer and use it in GitHub Desktop.
Save bhaskarkc/ebb44fa8e2a4e8b5a39d to your computer and use it in GitHub Desktop.
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