Automattic\WooCommerce\Blocks\BlockTypes

PaymentMethodIcons::get_enabled_card_typesprivateWC 1.0

Get the enabled card types for WooPayments.

Note: This uses hardcoded cards based on the default card types provided by WooPayments. This should be updated when these icons can be accessed via an API.

Method of the class: PaymentMethodIcons{}

No Hooks.

Returns

Array. Enabled card types.

Usage

// private - for code of main (parent) class only
$result = $this->get_enabled_card_types();

PaymentMethodIcons::get_enabled_card_types() code WC 10.3.6

private function get_enabled_card_types() {
	if ( ! $this->is_woopayments_enabled() ) {
		return array();
	}

	$card_types = array(
		'visa'       => array(
			'name' => 'Visa',
			'icon' => $this->get_card_type_icon_url( 'visa' ),
		),
		'mastercard' => array(
			'name' => 'Mastercard',
			'icon' => $this->get_card_type_icon_url( 'mastercard' ),
		),
		'amex'       => array(
			'name' => 'American Express',
			'icon' => $this->get_card_type_icon_url( 'amex' ),
		),
		'discover'   => array(
			'name' => 'Discover',
			'icon' => $this->get_card_type_icon_url( 'discover' ),
		),
		'jcb'        => array(
			'name' => 'JCB',
			'icon' => $this->get_card_type_icon_url( 'jcb' ),
		),
	);

	return $card_types;
}