WordPress at Your Fingertips
function is not described

WC_Marketplace_Suggestions::get_suggestions_api_data() public WC 1.0

Pull suggestion data from options. This is retrieved from a remote endpoint.

{} It's a method of the class: WC_Marketplace_Suggestions{}

No Hooks.

Return

Array. of json API data

Usage

$result = WC_Marketplace_Suggestions::get_suggestions_api_data();

Code of WC_Marketplace_Suggestions::get_suggestions_api_data() WC 5.9.0

public static function get_suggestions_api_data() {
	$data = get_option( 'woocommerce_marketplace_suggestions', array() );

	// If the options have never been updated, or were updated over a week ago, queue update.
	if ( empty( $data['updated'] ) || ( time() - WEEK_IN_SECONDS ) > $data['updated'] ) {
		$next = WC()->queue()->get_next( 'woocommerce_update_marketplace_suggestions' );
		if ( ! $next ) {
			WC()->queue()->cancel_all( 'woocommerce_update_marketplace_suggestions' );
			WC()->queue()->schedule_single( time(), 'woocommerce_update_marketplace_suggestions' );
		}
	}

	return ! empty( $data['suggestions'] ) ? $data['suggestions'] : array();
}