Shifting of billing fields to shipping tab

[ad_1]

Hi!

I want to keep the First name and Last name fields in Billing tab and move all other to shipping tab. I can do this with following code in functions.php. However I get internal server error when trying to checkout. Any help would be highly appreciated.

function billing_fields_another_group( $checkout_fields ){

// 1. We assign a field array to another group here
$checkout_fields[ ‘order’ ][ ‘billing_company’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_company’ ];

$checkout_fields[ ‘order’ ][ ‘billing_country’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_country’ ];

$checkout_fields[ ‘order’ ][ ‘billing_address_1’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_address_1’ ];

$checkout_fields[ ‘order’ ][ ‘billing_address_2’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_address_2’ ];

$checkout_fields[ ‘order’ ][ ‘billing_city’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_city’ ];

$checkout_fields[ ‘order’ ][ ‘billing_state’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_state’ ];

$checkout_fields[ ‘order’ ][ ‘billing_postcode’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_postcode’ ];

$checkout_fields[ ‘order’ ][ ‘billing_phone’ ] = $checkout_fields[ ‘billing’ ][ ‘billing_phone’ ];

// 2. Remove a field from a previous location
unset( $checkout_fields[ ‘billing’ ][ ‘billing_company’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_country’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_address_1’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_address_2’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_city’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_state’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_postcode’ ] );
unset( $checkout_fields[ ‘billing’ ][ ‘billing_phone’ ] );

return $checkout_fields;

}

Regards,
J.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer