WordPress filter hook

woocommerce_checkout_customer_id

Defined by WooCommerce and fired by 21 plugins in total, running on 7M+ sites between them.

“Provides an opportunity to modify the customer ID associated with the current checkout process.”

How to use woocommerce_checkout_customer_id

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_checkout_customer_id', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from Greenpay Payment Gateway's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

21 plugins that fire woocommerce_checkout_customer_id

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/class-wc-checkout.php:191
  2. Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce icon Product Labels, Quick View, Buy Now, Pre-Orders, Frequently Bought Together & More for WooCommerce8,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) inc/modules/pre-orders/class-pre-orders-main-functionality.php:563
  3. NP Quote Request for WooCommerce icon NP Quote Request for WooCommerce8,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/classes/gpls_woo_rfq_functions.php:1472
  4. Deposits & Partial Payments for WooCommerce icon Deposits & Partial Payments for WooCommerce5,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/class-awcdp-front-end.php:1763
  5. Pay with Vipps and MobilePay for WooCommerce icon Pay with Vipps and MobilePay for WooCommerce5,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) payment/WC_Gateway_Vipps.class.php:3966
  6. AliNext icon AliNext4,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/classes/controller/FrontendInitController.php:272
  7. Address Book for WooCommerce icon Address Book for WooCommerce3,000+ installs apply_filters( 'woocommerce_checkout_customer_id', current_user_id( 'woocommerce_checkout_update_customer_data' ) ) includes/address-book.php:360
  8. Sezzle Woocommerce Payment icon Sezzle Woocommerce Payment1,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/class-sezzle-checkout.php:166
  9. Constant Contact + WooCommerce icon Constant Contact + WooCommerce1,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) src/Utility/CheckoutBlockNewsletter.php:135
  10. Novalnet Payment Gateway for WooCommerce icon Novalnet Payment Gateway for WooCommerce1,000+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) class-wc-novalnet.php:1086
  11. 워드프레스 결제 심플페이 icon 워드프레스 결제 심플페이900+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/class-pafw-simple-pay.php:106
  12. Greenpay Payment Gateway icon Greenpay Payment Gateway100+ installs apply_filters( 'woocommerce_checkout_customer_id', $user_id ?? '' ) includes/class-gateway-greenpay.php:922
  13. Diller Loyalty icon Diller Loyalty90+ installs apply_filters( 'woocommerce_checkout_customer_id', $follower->get_wp_user_id() ) includes/class-diller-loyalty-woocommerce.php:1508
  14. DEPART icon DEPART20+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) inc/deposit-block.php:141
  15. Hygglig Checkout icon Hygglig Checkout10+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) classes/class-hygglig-checkout.php:673
  16. Long Term Interest-Free by HummGroup, New Zealand for WooCommerce icon Long Term Interest-Free by HummGroup, New Zealand for WooCommerce10+ installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/flexicardsltfo_gateway.php:371
  17. Briqpay for WooCommerce icon Briqpay for WooCommerce10+ installs apply_filters( 'woocommerce_checkout_customer_id', $customer_id ) includes/class-checkout-handler.php:3022
  18. GreenPay Payment Service icon GreenPay Payment Service10+ installs apply_filters( 'woocommerce_checkout_customer_id', $user_id ?? '' ) includes/class-gateway-greenpay.php:1352
  19. TogetherPay for WooCommerce icon TogetherPay for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) class/WC_Gateway_SplitOff.php:1888
  20. Paydock for WooCommerce icon Paydock for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/Helpers/OrderHelper.php:40
  21. Official Viapay Checkout Gateway icon Official Viapay Checkout GatewayFewer than 10 installs apply_filters( 'woocommerce_checkout_customer_id', get_current_user_id() ) includes/class-wc-viapay-order-statuses.php:206

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.