woocommerce_customer_allowed_session_meta_keys
Filter the allowed session meta data keys.
If the customer object contains any meta data with these keys, it will be stored within the WooCommerce session.
Использование
add_filter( 'woocommerce_customer_allowed_session_meta_keys', 'wp_kama_woocommerce_customer_allowed_session_meta_keys_filter', 10, 2 ); /** * Function for `woocommerce_customer_allowed_session_meta_keys` filter-hook. * * @param array $allowed_keys The allowed meta data keys. * @param WC_Customer $customer The customer object. * * @return array */ function wp_kama_woocommerce_customer_allowed_session_meta_keys_filter( $allowed_keys, $customer ){ // filter... return $allowed_keys; }
- $allowed_keys(массив)
- The allowed meta data keys.
- $customer(WC_Customer)
- The customer object.
Список изменений
С версии 8.7.0 | Введена. |
Где вызывается хук
woocommerce_customer_allowed_session_meta_keys
woocommerce/includes/data-stores/class-wc-customer-data-store-session.php 97
$allowed_keys = apply_filters( 'woocommerce_customer_allowed_session_meta_keys', array(), $customer );
Где используется хук в WooCommerce
woocommerce/src/Blocks/Domain/Services/CheckoutFields.php 104
add_filter( 'woocommerce_customer_allowed_session_meta_keys', array( $this, 'add_session_meta_keys' ) );