Automattic\WooCommerce\Admin\API

OnboardingFreeExtensions::get_available_extensions()publicWC 1.0

Return available payment methods.

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

Хуки из метода

Возвращает

WP_Error|WP_REST_Response.

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

$OnboardingFreeExtensions = new OnboardingFreeExtensions();
$OnboardingFreeExtensions->get_available_extensions( $request );
$request(WP_REST_Request) (обязательный)
Request data.

Код OnboardingFreeExtensions::get_available_extensions() WC 8.9.0

public function get_available_extensions( $request ) {
	$extensions = RemoteFreeExtensions::get_extensions();
	/**
	* Allows removing Jetpack suggestions from WooCommerce Admin when false.
	 *
	 * In this instance it is removed from the list of extensions suggested in the Onboarding Profiler. This list is first retrieved from the WooCommerce.com API, then if a plugin with the 'jetpack' slug is found, it is removed.
	 *
	 * @since 7.8
	*/
	if ( false === apply_filters( 'woocommerce_suggest_jetpack', true ) ) {
		foreach ( $extensions as &$extension ) {
			$extension['plugins'] = array_filter(
				$extension['plugins'],
				function( $plugin ) {
					return 'jetpack' !== $plugin->key;
				}
			);
		}
	}

	$extensions = $this->replace_jetpack_with_jetpack_boost_for_treatment( $extensions );

	return new WP_REST_Response( $extensions );
}