Filter uncanny-automator

wwlc_filter_address1_field_form_placeholder

Filters the placeholder text for the Address Line 1 field in WooCommerce Wholesale Order Forms.

add_filter( 'wwlc_filter_address1_field_form_placeholder', $callback, 10, 1 );

Description

Filter the placeholder text for the "Address line 1" field in Wholesale Suite forms. Developers can modify this placeholder to customize the user experience, for example, by adding specific instructions or examples. The default placeholder is retrieved from the WordPress option 'wwlc_fields_address_placeholder'.


Usage

add_filter( 'wwlc_filter_address1_field_form_placeholder', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

<?php
/**
 * Example of using the wwlc_filter_address1_field_form_placeholder filter.
 * This filter allows you to modify the placeholder text for the Address Line 1 field
 * in a Wholesale Lead Capture form.
 *
 * In this example, we'll prepend a helpful instruction to the placeholder text
 * if the user hasn't set a custom placeholder in their WordPress options.
 */
add_filter( 'wwlc_filter_address1_field_form_placeholder', function( $placeholder_text ) {
	// Check if the placeholder text is empty (meaning no custom placeholder is set via options).
	if ( empty( $placeholder_text ) ) {
		// If it's empty, provide a default, more descriptive placeholder.
		$placeholder_text = esc_attr__( 'Enter your street address', 'your-text-domain' );
	} else {
		// If a custom placeholder is set, you might want to append something or simply return it.
		// For this example, let's just return the custom placeholder as is.
		// If you wanted to add to it:
		// $placeholder_text = $placeholder_text . ' (e.g., 123 Main St)';
	}

	// Always return the modified or original placeholder text.
	return $placeholder_text;
}, 10, 1 ); // Priority 10, accepts 1 argument.
?>

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:128

'options'  => $countryList,
			),
			'wwlc_address'      => array(
				'label'       => apply_filters( 'wwlc_filter_address1_field_form_label', esc_html__( 'Address line 1', 'uncanny-automator' ) ),
				'type'        => 'text',
				'required'    => ( get_option( 'wwlc_fields_require_address_field' ) == 'yes' ) ? true : false,
				'active'      => ( get_option( 'wwlc_fields_activate_address_field' ) == 'yes' ) ? true : false,
				'placeholder' => apply_filters( 'wwlc_filter_address1_field_form_placeholder', get_option( 'wwlc_fields_address_placeholder', '' ) ),
			),
			'wwlc_address_2'    => array(
				'label'       => apply_filters( 'wwlc_filter_address2_field_form_label', esc_html__( 'Address line 2', 'uncanny-automator' ) ),
				'type'        => 'text',
				'required'    => false,
				'active'      => ( get_option( 'wwlc_fields_activate_address_field' ) == 'yes' ) ? true : false,
				'placeholder' => apply_filters( 'wwlc_filter_address2_field_form_placeholder', get_option( 'wwlc_fields_address2_placeholder', '' ) ),


Scroll to Top