Hi @bemay1,
Yes. You can use the code snippet below to move the billing first and last name fields to the “contact” step and remove the billing section (step 3).
I recommend keeping the first and last name fields as they are used to create the user’s account. I’m not sure if in the lack of the billing name the shipping name fields would be used instead.
In case you want to remove also the billing first and last name fields, just uncomment those lines in the code snippet.
/**
* Move fields to the contact substep.
*/
function fluidcheckout_move_fields_to_contact_substep( $contact_field_ids ) {
// Fields before existing fields
// $contact_field_ids = array_merge( array( 'billing_first_name', 'billing_last_name' ), $contact_field_ids );
// Fields after existing fields
$contact_field_ids = array_merge( $contact_field_ids, array( 'billing_first_name', 'billing_last_name' ) );
return $contact_field_ids;
}
add_filter( 'fc_checkout_contact_step_field_ids', 'fluidcheckout_move_fields_to_contact_substep', 10 );
/**
* Remove billing fields, except email.
*
* @param array $fields Fields used in checkout.
*/
function fluidcheckout_remove_billing_fields( $fields ) {
// unset( $fields[ 'billing_first_name' ] );
// unset( $fields[ 'billing_last_name' ] );
unset( $fields[ 'billing_company' ] );
unset( $fields[ 'billing_phone' ] );
unset( $fields[ 'billing_address_1' ] );
unset( $fields[ 'billing_address_2' ] );
unset( $fields[ 'billing_city' ] );
unset( $fields[ 'billing_state' ] );
unset( $fields[ 'billing_country' ] );
unset( $fields[ 'billing_postcode' ] );
return $fields;
}
add_filter( 'woocommerce_billing_fields', 'fluidcheckout_remove_billing_fields', 300 );
/**
* Remove the billing step.
*/
function fluidcheckout_remove_billing_step() {
// Bail if steps class not available
if ( ! class_exists( 'FluidCheckout_Steps' ) ) { return; }
FluidCheckout_Steps::instance()->unregister_checkout_step( 'billing' );
}
add_action( 'fc_register_steps', 'fluidcheckout_remove_billing_step', 300 );
If you are unsure about how to add the code snippet, check our article:
How to safely add code snippets to your WooCommerce website
Best,
Diego