Updates, Tips & Tricks

Updates as Released, Plus My Personal Collection Of WordPress Best Practices

Customize WooCommerce Checkout Fields

11 April

You can use a filter to override the WooCommerce checkout fields that display, and also change their content. Here’s an example snippet of how to do that. Add it to your functions.php:

// Customize Checkout Fields
function custom_override_checkout_fields( $fields ) {
    $fields['billing']['billing_company']['label'] = 'Organization';
    $fields['billing']['billing_company']['required'] = true;
    $fields['billing']['billing_company']['placeholder'] = 'Your Organization\'s Name';
    $fields['order']['order_comments']['placeholder'] = '';
    $fields['order']['order_comments']['label'] = 'Notes';
    $fields['account']['account_username']['label'] = 'Your Account username';
    $fields['account']['account_password']['label'] = 'Your Account password';
    $fields['account']['account_password-2']['label'] = 'Your Account password';
    return $fields;
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
No comments yet.

Leave a Reply