woocommerce_json_search_found_customers
Filter to customize the display of the currently selected customer for an order in the order edit page. This is the same filter used in the ajax call for customer search in the same metabox.
Использование
add_filter( 'woocommerce_json_search_found_customers', 'wp_kama_woocommerce_json_search_found_customers_filter' );
/**
* Function for `woocommerce_json_search_found_customers` filter-hook.
*
* @param array $found_users An array containing the selected customer label keyed by user ID. Guest
* orders contain a single empty string with numeric key 0.
*
* @return array
*/
function wp_kama_woocommerce_json_search_found_customers_filter( $found_users ){
// filter...
return $found_users;
}
- $found_users(массив)
- An array containing the selected customer label keyed by user ID. Guest orders contain a single empty string with numeric key 0.
Список изменений
| С версии 7.2.0 | Введена. |
| С версии 7.2.0 | (this instance of the filter) |
Где вызывается хук
woocommerce_json_search_found_customers
woocommerce_json_search_found_customers
woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php 504
<option value="<?php echo esc_attr( $user_id ); ?>" selected="selected"><?php echo esc_html( htmlspecialchars( wp_kses_post( current( apply_filters( 'woocommerce_json_search_found_customers', $found_users ) ) ), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) ); ?></option>
woocommerce/includes/class-wc-ajax.php 2333
wp_send_json( apply_filters( 'woocommerce_json_search_found_customers', $found_customers ) );