Automattic\WooCommerce\Blocks\BlockTypes

Checkout::include_token_id_with_payment_methods()public staticWC 1.0

Callback for woocommerce_payment_methods_list_item filter to add token id to the generated list.

Метод класса: Checkout{}

Хуков нет.

Возвращает

Массив. The list item with the token id added.

Использование

$result = Checkout::include_token_id_with_payment_methods( $list_item, $token );
$list_item(массив) (обязательный)
The current list item for the saved payment method.
$token(\WC_Token) (обязательный)
The token for the current list item.

Код Checkout::include_token_id_with_payment_methods() WC 8.7.0

public static function include_token_id_with_payment_methods( $list_item, $token ) {
	$list_item['tokenId'] = $token->get_id();
	$brand                = ! empty( $list_item['method']['brand'] ) ?
		strtolower( $list_item['method']['brand'] ) :
		'';
	// phpcs:ignore WordPress.WP.I18n.TextDomainMismatch -- need to match on translated value from core.
	if ( ! empty( $brand ) && esc_html__( 'Credit card', 'woocommerce' ) !== $brand ) {
		$list_item['method']['brand'] = wc_get_credit_card_type_label( $brand );
	}
	return $list_item;
}