woocommerce_sanitize_additional_field filter-hookWC 8.7.0

Allow custom sanitization of an additional field.

Usage

add_filter( 'woocommerce_sanitize_additional_field', 'wp_kama_woocommerce_sanitize_additional_field_filter', 10, 2 );

/**
 * Function for `woocommerce_sanitize_additional_field` filter-hook.
 * 
 * @param mixed  $field_value The value of the field being sanitized.
 * @param string $field_key   Key of the field being sanitized.
 *
 * @return mixed
 */
function wp_kama_woocommerce_sanitize_additional_field_filter( $field_value, $field_key ){

	// filter...
	return $field_value;
}
$field_value(mixed)
The value of the field being sanitized.
$field_key(string)
Key of the field being sanitized.

Changelog

Since 8.7.0 Introduced.

Where the hook is called

CheckoutFields::sanitize_field()
woocommerce_sanitize_additional_field
woocommerce/src/Blocks/Domain/Services/CheckoutFields.php 692
return apply_filters( 'woocommerce_sanitize_additional_field', $field_value, $field_key );

Where the hook is used in WooCommerce

Usage not found.