wc_get_account_saved_payment_methods_list_item_cc()
Controls the output for credit cards on the my account page.
No Hooks.
Return
Array
. Filtered item.
Usage
wc_get_account_saved_payment_methods_list_item_cc( $item, $payment_token );
- $item(array) (required)
- Individual list item from woocommerce_saved_payment_methods_list.
- $payment_token(WC_Payment_Token) (required)
- The payment token associated with this method entry.
Changelog
Since 2.6 | Introduced. |
wc_get_account_saved_payment_methods_list_item_cc() wc get account saved payment methods list item cc code WC 9.4.2
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 ) ? ucwords( str_replace( '_', ' ', $card_type ) ) : esc_html__( 'Credit card', 'woocommerce' ) ); $item['expires'] = $payment_token->get_expiry_month() . '/' . substr( $payment_token->get_expiry_year(), -2 ); return $item; }