Last active
February 10, 2016 15:26
-
-
Save hirejordansmith/ecafc14cb0d17ae9ba96 to your computer and use it in GitHub Desktop.
How to change the WooCommerce checkout page billing and address forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Billing Field - left side of checkout page | |
['billing']['billing_first_name'] | |
['billing']['billing_last_name'] | |
['billing']['billing_company'] | |
['billing']['billing_address_1'] | |
['billing']['billing_address_2'] | |
['billing']['billing_city'] | |
['billing']['billing_postcode'] | |
['billing']['billing_country'] | |
['billing']['billing_state'] | |
['billing']['billing_email'] | |
['billing']['billing_phone'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Shipping Field - right side of checkout page | |
['shipping']['shipping_first_name'] | |
['shipping']['shipping_last_name'] | |
['shipping']['shipping_company'] | |
['shipping']['shipping_address_1'] | |
['shipping']['shipping_address_2'] | |
['shipping']['shipping_city'] | |
['shipping']['shipping_postcode'] | |
['shipping']['shipping_country'] | |
['shipping']['shipping_state'] | |
['account']['account_username'] | |
['account']['account_password'] | |
['account']['account_password-2'] | |
['order']['order_comments'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment