Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks
WooCommercePayments::get_suggestion
Get the WooPayments payment gateway suggestion.
Метод класса: WooCommercePayments{}
Хуков нет.
Возвращает
Объект|null. The WooPayments suggestion, or null if none found.
Использование
$result = WooCommercePayments::get_suggestion();
Код WooCommercePayments::get_suggestion() WooCommercePayments::get suggestion WC 10.8.1
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 );
}