WordPress at Your Fingertips
function is not described

WC_Payment_Tokens::get_customer_default_token() public WC 2.6.0

Returns a customers default token or NULL if there is no default token.

{} It's a method of the class: WC_Payment_Tokens{}

No Hooks.

Return

WC_Payment_Token|null.

Usage

$result = WC_Payment_Tokens::get_customer_default_token( $customer_id );
$customer_id(int) (required)
Customer ID.

Changelog

Since 2.6.0 Introduced.

Code of WC_Payment_Tokens::get_customer_default_token() WC 5.6.0

public static function get_customer_default_token( $customer_id ) {
	if ( $customer_id < 1 ) {
		return null;
	}

	$data_store = WC_Data_Store::load( 'payment-token' );
	$token      = $data_store->get_users_default_token( $customer_id );

	if ( $token ) {
		return self::get( $token->token_id, $token );
	} else {
		return null;
	}
}