skip to Main Content

I am looking for a way to add a radio button to the checkout in WooCommerce, which, when clicked, will remove the field in the checkout with the ID "billing_company_wi_vat". The field with this ID is set as required. I will be grateful for any advice.

2

Answers


  1. If I understand you want to disable the billing address completely?

    If yes, then here you are

    function cs_woocommerce_remote_billing_fields( $fields ) {
    unset( $fields['billing_phone'] );
    unset( $fields['billing_address_1'] );
    unset( $fields['billing_address_2'] );
    unset( $fields['billing_city'] );
    unset( $fields['billing_postcode'] );
    unset( $fields['billing_state'] );
    unset( $fields['billing_country'] );
    unset( $fields['billing_company'] );
    
    $fields['billing_email']['class'] = array( 'form-row-wide' );
    
    return $fields;
    

    }

    add_filter( ‘woocommerce_billing_fields’, ‘cs_woocommerce_remote_billing_fields’ );

    Login or Signup to reply.
  2. Maybe you have to check for custom checkout. At this point I think its the best option to change anything as you want instead to change in a wrong way the functionality of main checkout which may causes many problems in the future.

    Friendly, George

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search