Automattic\WooCommerce\Admin\Features\MarketingRecommendations
Init::get_misc_recommendations
Load misc recommendations from WooCommerce.com
Method of the class: Init{}
No Hooks.
Returns
Array.
Usage
$result = Init::get_misc_recommendations(): array;
Changelog
| Since 9.5.0 | Introduced. |
Init::get_misc_recommendations() Init::get misc recommendations code WC 10.5.0
public static function get_misc_recommendations(): array {
$specs = self::get_misc_recommendations_specs();
$results = self::evaluate_specs( $specs );
$specs_to_return = $results['suggestions'];
$specs_to_save = null;
if ( empty( $specs_to_return ) ) {
// When misc_recommendations is empty, replace it with defaults and save for 3 hours.
$specs_to_save = array();
} elseif ( count( $results['errors'] ) > 0 ) {
// When misc_recommendations is not empty but has errors, save it for 3 hours.
$specs_to_save = $specs;
}
if ( $specs_to_save ) {
MiscRecommendationsDataSourcePoller::get_instance()->set_specs_transient( $specs_to_save, 3 * HOUR_IN_SECONDS );
}
$errors = $results['errors'];
if ( ! empty( $errors ) ) {
self::log_errors( $errors );
}
return $specs_to_return;
}