Categories
WooCommerce

Woocommerce Checkout Page Customization

And Back to the Future.

Reorder checkout fields:

add_filter( 'woocommerce_checkout_fields', 'condless_reordering_checkout_fields' );
function condless_reordering_checkout_fields( $fields ) {
        $billing_order = array(
                'billing_first_name',
                'billing_last_name',
                'billing_email',
                'billing_phone',
                'billing_company',
                'billing_address_1',
                'billing_address_2',
                'billing_postcode',
                'billing_city',
                'billing_state',
                'billing_country'
        );
        $count = 0;
        $priority = 10;
        foreach( $billing_order as $field_name ) {
                $count++;
                $fields['billing'][$field_name]['priority'] = $count * $priority;
        }
        $fields['billing']['billing_email']['class'] = array('form-row-first');
        $fields['billing']['billing_phone']['class'] = array('form-row-last');
        $fields['billing']['billing_postcode']['class'] = array('form-row-first');
        $fields['billing']['billing_city']['class'] = array('form-row-last');
        return $fields;
}

As you probably have noticed- Jigowatt ltd, the developers of Jigoshop on which WooCommerce code is based, was named after the pronunciation mistake of the word Gigawatt in the movie Back to the Future.

Leave a Reply

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