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.
Usage
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(array)
- The allowed meta data keys.
- $customer(WC_Customer)
- The customer object.
Changelog
Since 8.7.0 | Introduced. |
Where the hook is called
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 );
Where the hook is used in WooCommerce
woocommerce/src/Blocks/Domain/Services/CheckoutFields.php 105
add_filter( 'woocommerce_customer_allowed_session_meta_keys', array( $this, 'add_session_meta_keys' ) );