Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions

Init::get_cached_or_default_suggestions()public staticWC 1.0

Gets either cached or default suggestions.

Method of the class: Init{}

Return

Array.

Usage

$result = Init::get_cached_or_default_suggestions();

Init::get_cached_or_default_suggestions() code WC 9.7.1

public static function get_cached_or_default_suggestions() {
	$specs = 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' )
		? DefaultPaymentGateways::get_all()
		: PaymentGatewaySuggestionsDataSourcePoller::get_instance()->get_cached_specs();

	if ( ! is_array( $specs ) || 0 === count( $specs ) ) {
		$specs = DefaultPaymentGateways::get_all();
	}
	/**
	 * Allows filtering of payment gateway suggestion specs
	 *
	 * @since 6.4.0
	 *
	 * @param array Gateway specs.
	 */
	$specs   = apply_filters( 'woocommerce_admin_payment_gateway_suggestion_specs', $specs );
	$results = EvaluateSuggestion::evaluate_specs( $specs );
	return $results['suggestions'];
}