A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Remove fields in the checkout process

The following code snippet will remove unnecessary fields in the checkout process. This can be useful if you are selling downloadable products where an address is unnecessary. Delete any lines from the code for the fields that you would like to remain on the checkout page (the email line should definitely be deleted from the code but is included for completeness).

/**
 * Remove fields in checkout process
 */

add_filter('woocommerce_checkout_fields', 'cc_override_checkout_fields');

function cc_override_checkout_fields($fields) {

    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['order']['order_comments']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_city']);

    return $fields;

}
View Raw Code ID: 1123