Filter
uncanny-automator
wwlc_filter_country_field_form_label
Filters the label for the country field on forms, allowing customization of the text displayed.
add_filter( 'wwlc_filter_country_field_form_label', $callback, 10, 1 );
Description
Filters the label for the country field in Wholesale Suite forms. Developers can modify this label to customize its display, useful for internationalization or specific branding. The default label is 'Country'.
Usage
add_filter( 'wwlc_filter_country_field_form_label', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
// Example: Change the label for the 'Country' field to be more specific.
add_filter( 'wwlc_filter_country_field_form_label', function( $label ) {
// Check if the current user is a wholesale customer and if we want to append this information.
if ( is_user_logged_in() && current_user_can( 'wholesale_customer' ) ) {
$label .= ' (Wholesale)';
}
return $label;
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/wholesale-suite/helpers/wholesale-suite-helpers.php:117
'label' => apply_filters( 'wwlc_filter_company_field_form_label', esc_html__( 'Company name', 'uncanny-automator' ) ),
'type' => 'text',
'required' => ( get_option( 'wwlc_fields_require_company_name_field' ) == 'yes' ) ? true : false,
'active' => ( get_option( 'wwlc_fields_activate_company_name_field' ) == 'yes' ) ? true : false,
'placeholder' => ( get_option( 'wwlc_fields_company_field_placeholder' ) ) ? get_option( 'wwlc_fields_company_field_placeholder' ) : '',
),
'wwlc_country' => array(
'label' => apply_filters( 'wwlc_filter_country_field_form_label', esc_html__( 'Country', 'uncanny-automator' ) ),
'type' => 'select',
'required' => ( get_option( 'wwlc_fields_require_address_field' ) == 'yes' ) ? true : false,
'active' => ( get_option( 'wwlc_fields_activate_address_field' ) == 'yes' ) ? true : false,
'options' => $countryList,
),
'wwlc_address' => array(
'label' => apply_filters( 'wwlc_filter_address1_field_form_label', esc_html__( 'Address line 1', 'uncanny-automator' ) ),