WC_Admin_Setup_Wizard::get_wizard_in_cart_payment_gateways()publicWC 1.0

Deprecated from version 4.6.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Simple array of "in cart" gateways to show in wizard.

Method of the class: WC_Admin_Setup_Wizard{}

No Hooks.

Return

Array.

Usage

$WC_Admin_Setup_Wizard = new WC_Admin_Setup_Wizard();
$WC_Admin_Setup_Wizard->get_wizard_in_cart_payment_gateways();

Changelog

Deprecated since 4.6.0

WC_Admin_Setup_Wizard::get_wizard_in_cart_payment_gateways() code WC 8.9.0

public function get_wizard_in_cart_payment_gateways() {
	_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
	$gateways = $this->get_wizard_available_in_cart_payment_gateways();
	$country  = WC()->countries->get_base_country();
	$currency = get_woocommerce_currency();

	$can_stripe  = $this->is_stripe_supported_country( $country );
	$can_eway    = $this->is_eway_payments_supported_country( $country );
	$can_payfast = ( 'ZA' === $country ); // South Africa.
	$can_paypal  = $this->is_paypal_supported_currency( $currency );

	if ( ! current_user_can( 'install_plugins' ) ) {
		return $can_paypal ? array( 'paypal' => $gateways['paypal'] ) : array();
	}

	$klarna_or_square = false;

	if ( $this->is_klarna_checkout_supported_country( $country ) ) {
		$klarna_or_square = 'klarna_checkout';
	} elseif ( $this->is_klarna_payments_supported_country( $country ) ) {
		$klarna_or_square = 'klarna_payments';
	} elseif ( $this->is_square_supported_country( $country ) && get_option( 'woocommerce_sell_in_person' ) ) {
		$klarna_or_square = 'square';
	}

	$offered_gateways = array();

	if ( $can_stripe ) {
		$gateways['stripe']['enabled']  = true;
		$gateways['stripe']['featured'] = true;
		$offered_gateways              += array( 'stripe' => $gateways['stripe'] );
	} elseif ( $can_paypal ) {
		$gateways['ppec_paypal']['enabled'] = true;
	}

	if ( $klarna_or_square ) {
		if ( in_array( $klarna_or_square, array( 'klarna_checkout', 'klarna_payments' ), true ) ) {
			$gateways[ $klarna_or_square ]['enabled']  = true;
			$gateways[ $klarna_or_square ]['featured'] = false;
			$offered_gateways                         += array(
				$klarna_or_square => $gateways[ $klarna_or_square ],
			);
		} else {
			$offered_gateways += array(
				$klarna_or_square => $gateways[ $klarna_or_square ],
			);
		}
	}

	if ( $can_paypal ) {
		$offered_gateways += array( 'ppec_paypal' => $gateways['ppec_paypal'] );
	}

	if ( $can_eway ) {
		$offered_gateways += array( 'eway' => $gateways['eway'] );
	}

	if ( $can_payfast ) {
		$offered_gateways += array( 'payfast' => $gateways['payfast'] );
	}

	return $offered_gateways;
}