wc_get_credit_card_type_label

Get a nice name for credit card providers.

Description

(string) wc_get_credit_card_type_label( (string) $type ); 

Returns (string)

Parameters (1)

0. $type (string)
Provider Slug/Type

Usage

  1. if ( !function_exists( 'wc_get_credit_card_type_label' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php'; 
  3.  
  4. // Provider Slug/Type 
  5. $type = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wc_get_credit_card_type_label($type); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/wc-core-functions.php  
  1. function wc_get_credit_card_type_label( $type ) { 
  2. // Normalize 
  3. $type = strtolower( $type ); 
  4. $type = str_replace( '-', ' ', $type ); 
  5. $type = str_replace( '_', ' ', $type ); 
  6.  
  7. $labels = apply_filters( 'wocommerce_credit_card_type_labels', array( 
  8. 'mastercard' => __( 'MasterCard', woocommerce ),  
  9. 'visa' => __( 'Visa', woocommerce ),  
  10. 'discover' => __( 'Discover', woocommerce ),  
  11. 'american express' => __( 'American Express', woocommerce ),  
  12. 'diners' => __( 'Diners', woocommerce ),  
  13. 'jcb' => __( 'JCB', woocommerce ),  
  14. ) ); 
  15.  
  16. return apply_filters( 'woocommerce_get_credit_card_type_label', ( array_key_exists( $type, $labels ) ? $labels[ $type ] : ucfirst( $type ) ) );