• Hi All,

    Im am trying to conditionally remove the EU VAT field from the checkout.

    I have a function that looks if products in a certain category are in the cart.
    If products in that category are in the cart, it returns true, if not, false.

    Now I want to use that to remove the he EU VAT field.

    Like so:

    /**
     * Conditionally remove a checkout field based on products in the cart
     */
    function my_wc_remove_checkout_field( $fields ) {
    	if ( ! my_wc_category_is_in_the_cart() ) {
    		unset( $fields['billing']['billing_company'] );
    		unset( $fields['billing']['billing_eu_vat_number'] );
    	}
    
    	return $fields;
    }
    add_filter( 'woocommerce_checkout_fields' , 'my_wc_remove_checkout_field',9999 );

    This works for the standard WOO fields, like Company came in the above example.

    But not for the EU VAT field.
    I looked into the plugin and my naming “billing_eu_vat_number” seems correct.
    But using “unset” on Booster generated fields seems to do nothing.

    What am I missing?

    Thanks

    • This topic was modified 3 years, 5 months ago by eagerbob.
  • The topic ‘Remove Booster field from checkout’ is closed to new replies.