WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin\API

Plugins::request_wccom_connect() public WC 1.0

Kicks off the WCCOM Connect process.

@return WP_Error|array Connection URL for WooCommerce.com

{} Это метод класса: Plugins{}

Хуки из метода
Возвращает

Null. Ничего.

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

$Plugins = new Plugins();
$Plugins->request_wccom_connect();

Код Plugins::request_wccom_connect() WC 4.7.1

<?php
public function request_wccom_connect() {
	include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-api.php';
	if ( ! class_exists( 'WC_Helper_API' ) ) {
		return new \WP_Error( 'woocommerce_rest_helper_not_active', __( 'There was an error loading the WooCommerce.com Helper API.', 'woocommerce' ), 404 );
	}

	$redirect_uri = wc_admin_url( '&task=connect&wccom-connected=1' );

	$request = \WC_Helper_API::post(
		'oauth/request_token',
		array(
			'body' => array(
				'home_url'     => home_url(),
				'redirect_uri' => $redirect_uri,
			),
		)
	);

	$code = wp_remote_retrieve_response_code( $request );
	if ( 200 !== $code ) {
		return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
	}

	$secret = json_decode( wp_remote_retrieve_body( $request ) );
	if ( empty( $secret ) ) {
		return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
	}

	do_action( 'woocommerce_helper_connect_start' );

	$connect_url = add_query_arg(
		array(
			'home_url'     => rawurlencode( home_url() ),
			'redirect_uri' => rawurlencode( $redirect_uri ),
			'secret'       => rawurlencode( $secret ),
			'wccom-from'   => 'onboarding',
		),
		\WC_Helper_API::url( 'oauth/authorize' )
	);

	if ( defined( 'WOOCOMMERCE_CALYPSO_ENVIRONMENT' ) && in_array( WOOCOMMERCE_CALYPSO_ENVIRONMENT, array( 'development', 'wpcalypso', 'horizon', 'stage' ), true ) ) {
		$connect_url = add_query_arg(
			array(
				'calypso_env' => WOOCOMMERCE_CALYPSO_ENVIRONMENT,
			),
			$connect_url
		);
	}

	return( array(
		'connectAction' => $connect_url,
	) );
}