Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
WooCommercePayments::get_suggestion
Get the WooPayments payment gateway suggestion.
Method of the class: WooCommercePayments{}
No Hooks.
Returns
Object|null. The WooPayments suggestion, or null if none found.
Usage
$result = WooCommercePayments::get_suggestion();
WooCommercePayments::get_suggestion() WooCommercePayments::get suggestion code WC 10.6.2
public static function get_suggestion() {
$suggestions = Suggestions::get_suggestions( DefaultPaymentGateways::get_all() );
$wcpay_suggestions = array_filter(
$suggestions,
function ( $suggestion ) {
if ( empty( $suggestion->plugins ) || ! is_array( $suggestion->plugins ) ) {
return false;
}
return in_array( 'woocommerce-payments', $suggestion->plugins, true );
}
);
if ( empty( $wcpay_suggestions ) ) {
return null;
}
return reset( $wcpay_suggestions );
}