WC_Admin_Setup_Wizard::setup_wizard()publicWC 1.0

Устарела с версии 4.6.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.

Show the setup wizard.

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

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

Возвращает

null. Ничего (null).

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

$WC_Admin_Setup_Wizard = new WC_Admin_Setup_Wizard();
$WC_Admin_Setup_Wizard->setup_wizard();

Список изменений

Устарела с 4.6.0

Код WC_Admin_Setup_Wizard::setup_wizard() WC 8.7.0

public function setup_wizard() {
	_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
	if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) { // WPCS: CSRF ok, input var ok.
		return;
	}
	$default_steps = array(
		'new_onboarding' => array(
			'name'    => '',
			'view'    => array( $this, 'wc_setup_new_onboarding' ),
			'handler' => array( $this, 'wc_setup_new_onboarding_save' ),
		),
		'store_setup'    => array(
			'name'    => __( 'Store setup', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_store_setup' ),
			'handler' => array( $this, 'wc_setup_store_setup_save' ),
		),
		'payment'        => array(
			'name'    => __( 'Payment', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_payment' ),
			'handler' => array( $this, 'wc_setup_payment_save' ),
		),
		'shipping'       => array(
			'name'    => __( 'Shipping', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_shipping' ),
			'handler' => array( $this, 'wc_setup_shipping_save' ),
		),
		'recommended'    => array(
			'name'    => __( 'Recommended', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_recommended' ),
			'handler' => array( $this, 'wc_setup_recommended_save' ),
		),
		'activate'       => array(
			'name'    => __( 'Activate', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_activate' ),
			'handler' => array( $this, 'wc_setup_activate_save' ),
		),
		'next_steps'     => array(
			'name'    => __( 'Ready!', 'woocommerce' ),
			'view'    => array( $this, 'wc_setup_ready' ),
			'handler' => '',
		),
	);

	// Hide the new/improved onboarding experience screen if the user is not part of the a/b test.
	if ( ! $this->should_show_wc_admin_onboarding() ) {
		unset( $default_steps['new_onboarding'] );
	}

	// Hide recommended step if nothing is going to be shown there.
	if ( ! $this->should_show_recommended_step() ) {
		unset( $default_steps['recommended'] );
	}

	// Hide shipping step if the store is selling digital products only.
	if ( 'virtual' === get_option( 'woocommerce_product_type' ) ) {
		unset( $default_steps['shipping'] );
	}

	// Hide activate section when the user does not have capabilities to install plugins, think multiside admins not being a super admin.
	if ( ! current_user_can( 'install_plugins' ) ) {
		unset( $default_steps['activate'] );
	}

	$this->steps = apply_filters( 'woocommerce_setup_wizard_steps', $default_steps );
	$this->step  = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); // WPCS: CSRF ok, input var ok.

	// @codingStandardsIgnoreStart
	if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
		call_user_func( $this->steps[ $this->step ]['handler'], $this );
	}
	// @codingStandardsIgnoreEnd

	ob_start();
	$this->setup_wizard_header();
	$this->setup_wizard_steps();
	$this->setup_wizard_content();
	$this->setup_wizard_footer();
	exit;
}