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

Automattic\WooCommerce\Admin\API

Plugins::connect_square() public WC 1.0

Returns a URL that can be used to connect to Square.

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

Хуков нет.

Возвращает

WP_Error/Массив. Connect URL.

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

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

Код Plugins::connect_square() WC 5.3.0

<?php
public function connect_square() {
	if ( ! class_exists( '\WooCommerce\Square\Handlers\Connection' ) ) {
		return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to Square.', 'woocommerce' ), 500 );
	}

	if ( 'US' === WC()->countries->get_base_country() ) {
		$profile = get_option( Onboarding::PROFILE_DATA_OPTION, array() );
		if ( ! empty( $profile['industry'] ) ) {
			$has_cbd_industry = in_array( 'cbd-other-hemp-derived-products', array_column( $profile['industry'], 'slug' ), true );
		}
	}

	if ( $has_cbd_industry ) {
		$url = 'https://squareup.com/t/f_partnerships/d_referrals/p_woocommerce/c_general/o_none/l_us/dt_alldevice/pr_payments/?route=/solutions/cbd';
	} else {
		$url = \WooCommerce\Square\Handlers\Connection::CONNECT_URL_PRODUCTION;
	}

	$redirect_url = wp_nonce_url( wc_admin_url( '&task=payments&method=square&square-connect-finish=1' ), 'wc_square_connected' );
	$args         = array(
		'redirect' => rawurlencode( rawurlencode( $redirect_url ) ),
		'scopes'   => implode(
			',',
			array(
				'MERCHANT_PROFILE_READ',
				'PAYMENTS_READ',
				'PAYMENTS_WRITE',
				'ORDERS_READ',
				'ORDERS_WRITE',
				'CUSTOMERS_READ',
				'CUSTOMERS_WRITE',
				'SETTLEMENTS_READ',
				'ITEMS_READ',
				'ITEMS_WRITE',
				'INVENTORY_READ',
				'INVENTORY_WRITE',
			)
		),
	);

	$connect_url = add_query_arg( $args, $url );

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