WC_Admin_Addons::install_woocommerce_payments_addon()public staticWC 1.0

Install WooCommerce Payments from the Extensions screens.

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

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

Возвращает

null. Ничего.

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

$result = WC_Admin_Addons::install_woocommerce_payments_addon( $section );
$section(строка)
Extenstions tab.
По умолчанию: '_featured'

Код WC_Admin_Addons::install_woocommerce_payments_addon() WC 7.1.0

public static function install_woocommerce_payments_addon( $section = '_featured' ) {
	check_admin_referer( 'install-addon_woocommerce-payments' );

	$wcpay_plugin_id = 'woocommerce-payments';
	$wcpay_plugin    = array(
		'name'      => __( 'WooCommerce Payments', 'woocommerce' ),
		'repo-slug' => 'woocommerce-payments',
	);

	WC_Install::background_installer( $wcpay_plugin_id, $wcpay_plugin );

	do_action( 'woocommerce_addon_installed', $wcpay_plugin_id, $section );

	wp_safe_redirect( remove_query_arg( array( 'install-addon', '_wpnonce' ) ) );
	exit;
}