/** * Controls the output for credit cards on the my account page. * * @since 2.6 * @param array $item Individual list item from woocommerce_saved_payment_methods_list * @param WC_Payment_Token $payment_token The payment token associated with this method entry * @return array Filtered item */ function wc_get_account_saved_payment_methods_list_item_cc($item, $payment_token) { if ('cc' !== strtolower($payment_token->get_type())) { return $item; } $card_type = $payment_token->get_card_type(); $item['method']['last4'] = $payment_token->get_last4(); $item['method']['brand'] = !empty($card_type) ? ucfirst($card_type) : esc_html__('Credit Card', 'woocommerce'); $item['expires'] = $payment_token->get_expiry_month() . '/' . substr($payment_token->get_expiry_year(), -2); return $item; }