Automattic\WooCommerce\Admin\Features\ShippingPartnerSuggestions

ShippingPartnerSuggestions::get_specs()public staticWC 1.0

Get specs or fetch remotely if they don't exist.

Метод класса: ShippingPartnerSuggestions{}

Возвращает

null. Ничего (null).

Использование

$result = ShippingPartnerSuggestions::get_specs();

Код ShippingPartnerSuggestions::get_specs() WC 9.7.1

public static function get_specs() {
	if ( 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) {
		/**
		 * It can be used to modify shipping partner suggestions spec.
		 *
		 * @since 7.4.1
		 */
		return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', DefaultShippingPartners::get_all() );
	}
	$specs = ShippingPartnerSuggestionsDataSourcePoller::get_instance()->get_specs_from_data_sources();

	// Fetch specs if they don't yet exist.
	if ( false === $specs || ! is_array( $specs ) || 0 === count( $specs ) ) {
		/**
		 * It can be used to modify shipping partner suggestions spec.
		 *
		 * @since 7.4.1
		 */
		return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', DefaultShippingPartners::get_all() );
	}

	/**
	 * It can be used to modify shipping partner suggestions spec.
	 *
	 * @since 7.4.1
	 */
	return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', $specs );
}