WooCommerce plugin for WordPress is the easiest way to start selling your products online. It handles many different payment options, gateways, tax calculations, shipments, and even stock tracking. All you need is installing the plugin and start adding your products.


While the plugin has many great features, for a shop with only downloadable products, you won’t need some of those functionalities like billing and shipment details.

woocommerce-billing-details-page

To remove billing and shipping fields from your checkout form, you can use the following snippet:

<?php 
// woo-remove-billing.php | metinsaylan | 2015-03-15

// This filter removes billing fields from woocommerce checkout page.
// Usage:
//   You can include this file in your functions.php file, 
//   or you can copy and paste this filter to your functions.php file.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
    unset($fields['order']['order_comments']);
    unset($fields['shipping']);
    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']);
	
    // Setting placeholder texts for Email, Name and Last Name
    $fields['billing']['billing_email']['placeholder'] = "E-mail address";

    $fields['billing']['billing_first_name']['required'] = false;
    $fields['billing']['billing_first_name']['placeholder'] = "First name";
   
    $fields['billing']['billing_last_name']['required'] = false;
    $fields['billing']['billing_last_name']['placeholder'] = "Last name";
     
    // Setting form field classes
    $fields['billing']['billing_email']['class'] = array('form-row-wide');
    $fields['billing']['billing_first_name']['class'] = array('form-row-wide');
    $fields['billing']['billing_last_name']['class'] = array('form-row-wide');
	 
    return $fields;
}

?>

I hope you found this tip useful, Cheers!

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *