Viewing 1 replies (of 1 total)
  • Hello @eightsages Use the below code this will show the email field for non-logged in user and remove field for logged out users.

    /**
    * This function is used for remove email field from the checkout
    * 
    * @name _custom_checkout_fields
    * @param array $address_fields  array of the address fields
    */
    function _custom_checkout_fields( $address_fields ) {
    	if( is_user_logged_in() ) {
    		unset( $address_fields['billing']['billing_email'] );
    	}
    	return $address_fields;
    }
    add_filter( 'woocommerce_checkout_fields', '_custom_checkout_fields' ,20, 1 );
Viewing 1 replies (of 1 total)
  • The topic ‘Remove email address field on checkout page – except when creating a new account’ is closed to new replies.