wc_get_credit_card_type_label()
Get a nice name for credit card providers.
Hooks from the function
Return
String
.
Usage
wc_get_credit_card_type_label( $type );
- $type(string) (required)
- Provider Slug/Type.
Changelog
Since 2.6.0 | Introduced. |
wc_get_credit_card_type_label() wc get credit card type label code WC 7.7.0
function wc_get_credit_card_type_label( $type ) { // Normalize. $type = strtolower( $type ); $type = str_replace( '-', ' ', $type ); $type = str_replace( '_', ' ', $type ); $labels = apply_filters( 'woocommerce_credit_card_type_labels', array( 'mastercard' => __( 'MasterCard', 'woocommerce' ), 'visa' => __( 'Visa', 'woocommerce' ), 'discover' => __( 'Discover', 'woocommerce' ), 'american express' => __( 'American Express', 'woocommerce' ), 'diners' => __( 'Diners', 'woocommerce' ), 'jcb' => __( 'JCB', 'woocommerce' ), ) ); return apply_filters( 'woocommerce_get_credit_card_type_label', ( array_key_exists( $type, $labels ) ? $labels[ $type ] : ucfirst( $type ) ) ); }