WC_Payment_Token_Data_Store::read_extra_data()protectedWC 3.0.0

Read extra data associated with the token (like last4 digits of a card for expiry dates).

Method of the class: WC_Payment_Token_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->read_extra_data( $token );
$token(WC_Payment_Token) (required) (passed by reference — &)
Payment token object.

Changelog

Since 3.0.0 Introduced.

WC_Payment_Token_Data_Store::read_extra_data() code WC 9.4.2

protected function read_extra_data( &$token ) {
	foreach ( $token->get_extra_data_keys() as $key ) {
		$function = 'set_' . $key;
		if ( is_callable( array( $token, $function ) ) ) {
			$token->{$function}( get_metadata( 'payment_token', $token->get_id(), $key, true ) );
		}
	}
}