Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to change the WooCommerce checkout page billing and address forms
// WooCommerce Checkout Fields Hook
add_filter( 'woocommerce_checkout_fields' , 'hjs_wc_checkout_fields' );
// This example changes the default placeholder text for the state drop downs to "Select A State"
function hjs_wc_checkout_fields( $fields ) {
$fields['billing']['billing_state']['placeholder'] = 'Select A State';
$fields['shipping']['shipping_state']['placeholder'] = 'Select A State';
return $fields;
// Billing Field - left side of checkout page
// These are the specific properties that can be used to customize the checkout fields
['type'] // Field Type. Valid types are text, textarea, password, or select.
['label'] // Field Label. Above the input box.
['placeholder'] // Placeholder text. Inside the input box.
['class'] // add a class to the field
['required'] // Display whether field should be required or not. Values either "true" or "false"
['clear'] // Apply clear fix to the field. Values either "true" or "false"
['label_class'] // add class to field label
['options'] // modify select boxes with an array of values
// Shipping Field - right side of checkout page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment