WC_Admin_Setup_Wizard::setup_wizard()publicWC 1.0

Deprecated from version 4.6.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Show the setup wizard.

Method of the class: WC_Admin_Setup_Wizard{}

Hooks from the method

Return

null. Nothing (null).

Usage

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

Changelog

Deprecated since 4.6.0

WC_Admin_Setup_Wizard::setup_wizard() code 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;
}