woocommerce_checkout_customer_id

woocommerce_checkout_customer_id

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_checkout_customer_id') is found 3 times:

  • /includes/class-wc-checkout.php line 173
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
                 * @since 3.0.0 or earlier
                 *
                 * @param int The current user's ID (this may be 0 if no user is logged in).
                 */
                return apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() );
            case 'shipping_methods':
                return (array) WC()->session->get( 'chosen_shipping_methods' );
        }
    }
     
    /**
  • /includes/class-wc-checkout.php line 450
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    * This action is documented in woocommerce/includes/class-wc-checkout.php
     *
     * @since 3.0.0 or earlier
     */
    $order->set_customer_id( apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) );
    $order->set_currency( get_woocommerce_currency() );
    $order->set_prices_include_tax( 'yes' === get_option( 'woocommerce_prices_include_tax' ) );
    $order->set_customer_ip_address( WC_Geolocation::get_ip_address() );
    $order->set_customer_user_agent( wc_get_user_agent() );
    $order->set_customer_note( isset( $data['order_comments'] ) ? $data['order_comments'] : '' );
    $order->set_payment_method( isset( $available_gateways[ $data['payment_method'] ] ) ? $available_gateways[ $data['payment_method'] ] : $data['payment_method'] );
  • /includes/class-wc-checkout.php line 1141
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    * This action is documented in woocommerce/includes/class-wc-checkout.php
     *
     * @since 3.0.0 or earlier
     */
    $customer_id = apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() );
     
    if ( ! is_user_logged_in() && ( $this->is_registration_required() || ! empty( $data['createaccount'] ) ) ) {
        $username    = ! empty( $data['account_username'] ) ? $data['account_username'] : '';
        $password    = ! empty( $data['account_password'] ) ? $data['account_password'] : '';
        $customer_id = wc_create_new_customer(
            $data['billing_email'],