WC_Payment_Tokens::get_customer_tokens( int $customer_id, string $gateway_id = '' )
Returns an array of payment token objects associated with the passed customer ID.
Description Description
Parameters Parameters
- $customer_id
-
(Required) Customer ID.
- $gateway_id
-
(Optional) Gateway ID for getting tokens for a specific gateway.
Default value: ''
Return Return
(WC_Payment_Token[]) Array of token objects.
Source Source
File: includes/class-wc-payment-tokens.php
public static function get_customer_tokens( $customer_id, $gateway_id = '' ) { if ( $customer_id < 1 ) { return array(); } $tokens = self::get_tokens( array( 'user_id' => $customer_id, 'gateway_id' => $gateway_id, ) ); return apply_filters( 'woocommerce_get_customer_payment_tokens', $tokens, $customer_id, $gateway_id ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |