Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

WooCommercePayments::get_action_url()publicWC 1.0

The task action URL.

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

Хуков нет.

Возвращает

Строку.

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

$WooCommercePayments = new WooCommercePayments();
$WooCommercePayments->get_action_url();

Код WooCommercePayments::get_action_url() WC 9.7.1

public function get_action_url() {
	if ( self::is_supported() ) {
		// If WooPayments is active, point to the WooPayments client surfaces/flows.
		if ( self::is_wcpay_active() ) {
			// Point to a WooPayments connect link to let the WooPayments client figure out the proper
			// place to redirect the user to.
			return add_query_arg(
				array(
					'wcpay-connect' => '1',
					'from'          => 'WCADMIN_PAYMENT_TASK',
					'_wpnonce'      => wp_create_nonce( 'wcpay-connect' ),
				),
				admin_url( 'admin.php' )
			);
		}

		// Check if there is an active WooPayments incentive via the welcome page.
		if ( WcPayWelcomePage::instance()->has_incentive() ) {
			// Point to the WooPayments welcome page.
			return add_query_arg( 'from', 'WCADMIN_PAYMENT_TASK', admin_url( 'admin.php?page=wc-admin&path=/wc-pay-welcome-page' ) );
		}

		// WooPayments is not active.
		// Trigger the WooPayments plugin installation and/or activation by pointing to the task suggestion URL.
		return add_query_arg(
			array(
				'task' => $this->get_id(),
				'id'   => self::get_suggestion()->id,
			),
			admin_url( 'admin.php?page=wc-admin' )
		);
	}

	// Fall back to the WooPayments task page URL.
	return add_query_arg( 'task', $this->get_id(), admin_url( 'admin.php?page=wc-admin' ) );
}