Automattic\WooCommerce\Internal\Admin

WcPaySubscriptionsPage::enqueue_scripts()publicWC 1.0

Enqueues an inline script on WooCommerce registered pages for use on the WooCommerce → Subscriptions admin page.

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

Хуков нет.

Возвращает

null. Ничего.

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

$WcPaySubscriptionsPage = new WcPaySubscriptionsPage();
$WcPaySubscriptionsPage->enqueue_scripts();

Код WcPaySubscriptionsPage::enqueue_scripts() WC 6.6.1

public function enqueue_scripts() {
	if ( ! PageController::get_instance()->is_registered_page() ) {
		return;
	}

	if ( ! $this->is_store_experiment_eligible() ) {
		return;
	}

	$data = array(
		'newSubscriptionProductUrl' => add_query_arg(
			array(
				'post_type'             => 'product',
				'select_subscription'   => 'true',
				'subscription_pointers' => 'true',
			),
			admin_url( 'post-new.php' )
		),
		'onboardingUrl'             => add_query_arg(
			array(
				'wcpay-connect' => 'WC_SUBSCRIPTIONS_TABLE',
				'_wpnonce'      => wp_create_nonce( 'wcpay-connect' ),
			),
			admin_url( 'admin.php' )
		),
		'dismissOptionKey'          => $this->user_dismissed_option,
		'noThanksUrl'               => wc_admin_url(),
		'experimentAssignment'      => $this->get_user_experiment_assignment(),
	);

	wp_add_inline_script( WC_ADMIN_APP, 'window.wcWcpaySubscriptions = ' . wp_json_encode( $data ), 'before' );
}