How to Remove Custom Fields from another Wholesale Registration Form

Table Of Contents

    The WooCommerce Wholesale Lead Capture plugin allows multiple wholesale registration forms by the use of shortcodes.

    However, all enabled standard and custom fields on the Wholesale Lead settings are applied to all wholesale registration forms. So if you want to remove certain fields from an individual registration form, you can use the custom snippet provided below.

    add_filter('wwlc_registration_form_fields', function($fields) {
        // Remove custom field on this page only
        if( get_the_ID() == 1234 ) {
            foreach( $fields as $key => $field ) {
            // Target the Field ID of custom field
            if( $field[ 'id' ] == 'wwlc_cf_example' )
            unset( $fields[ $key ] );
            }
        }
    return $fields;
    } , 10 , 1);
    

    In the example above, you need to replace the ID of 1234 to the Page ID of the wholesale registration page you want to remove the custom field on.

    Next, the ‘wwlc_cf_example’ string should be changed to match the field name you want to remove from that particular registration page.

    You can go to WooCommerce > Settings > Wholesale Lead > Custom Fields, to check the Field ID of the custom field you want to remove.

    Then put this on the functions.php file of your theme/child theme to apply the change to your Wholesale Registration Form.

    in WooCommerce Wholesale Lead Capture