woocommerce_checkout_customer_id
Provides an opportunity to modify the customer ID associated with the current checkout process.
Usage
add_filter( 'woocommerce_checkout_customer_id', 'wp_kama_woocommerce_checkout_customer_id_filter' ); /** * Function for `woocommerce_checkout_customer_id` filter-hook. * * @param int $current_user_id The current user's ID (this may be 0 if no user is logged in). * * @return int */ function wp_kama_woocommerce_checkout_customer_id_filter( $current_user_id ){ // filter... return $current_user_id; }
- $current_user_id(int)
- The current user's ID (this may be 0 if no user is logged in).
Changelog
Since 3.0.0 | Introduced. |
Since 3.0.0 | or earlier |
Where the hook is called
woocommerce_checkout_customer_id
woocommerce_checkout_customer_id
woocommerce_checkout_customer_id
woocommerce/includes/class-wc-checkout.php 168
return apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() );
woocommerce/includes/class-wc-checkout.php 435
$order->set_customer_id( apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) );
woocommerce/includes/class-wc-checkout.php 1119
$customer_id = apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() );