Automattic\WooCommerce\StoreApi\Utilities
PaymentUtils::include_token_id_with_payment_methods
Callback for woocommerce_payment_methods_list_item filter to add token id to the generated list.
Метод класса: PaymentUtils{}
Хуков нет.
Возвращает
Массив. The list item with the token id added.
Использование
$result = PaymentUtils::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.
Код PaymentUtils::include_token_id_with_payment_methods() PaymentUtils::include token id with payment methods WC 11.0.1
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'] ) :
'';
if ( ! empty( $brand ) && esc_html__( 'Credit card', 'woocommerce' ) !== $brand ) {
$list_item['method']['brand'] = wc_get_credit_card_type_label( $brand );
}
return $list_item;
}