wc_get_credit_card_type_label( string $type )

Get a nice name for credit card providers.


Description Description


Parameters Parameters

$type

(Required) Provider Slug/Type.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-core-functions.php

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 ) ) );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.