WordPress at Your Fingertips
function is not described

WC_Admin_Setup_Wizard::wc_setup_activate() public WC 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.

Activate step.

{} It's a method of the class: WC_Admin_Setup_Wizard{}

No Hooks.

Return

null. Nothing.

Usage

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

Changelog

Deprecated 4.6.0

Code of WC_Admin_Setup_Wizard::wc_setup_activate() WC 5.9.0

<?php
public function wc_setup_activate() {
	_deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' );
	$this->wc_setup_activate_actions();

	$jetpack_connected = class_exists( 'Jetpack' ) && Jetpack::is_active();

	$has_jetpack_error = false;
	if ( isset( $_GET['activate_error'] ) ) {
		$has_jetpack_error = true;

		$title = __( "Sorry, we couldn't connect your store to Jetpack", 'woocommerce' );

		$error_message = $this->get_activate_error_message( sanitize_text_field( wp_unslash( $_GET['activate_error'] ) ) );
		$description = $error_message;
	} else {
		$feature_list = $this->wc_setup_activate_get_feature_list_str();

		$description = false;

		if ( $feature_list ) {
			if ( ! $jetpack_connected ) {
				/* translators: %s: list of features, potentially comma separated */
				$description_base = __( 'Your store is almost ready! To activate services like %s, just connect with Jetpack.', 'woocommerce' );
			} else {
				$description_base = __( 'Thanks for using Jetpack! Your store is almost ready: to activate services like %s, just connect your store.', 'woocommerce' );
			}
			$description = sprintf( $description_base, $feature_list );
		}

		if ( ! $jetpack_connected ) {
			$title = $feature_list ?
				__( 'Connect your store to Jetpack', 'woocommerce' ) :
				__( 'Connect your store to Jetpack to enable extra features', 'woocommerce' );
			$button_text = __( 'Continue with Jetpack', 'woocommerce' );
		} elseif ( $feature_list ) {
			$title = __( 'Connect your store to activate WooCommerce Services', 'woocommerce' );
			$button_text = __( 'Continue with WooCommerce Services', 'woocommerce' );
		} else {
			wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
			exit;
		}
	}
	?>
	<h1><?php echo esc_html( $title ); ?></h1>
	<p><?php echo esc_html( $description ); ?></p>

	<?php if ( $jetpack_connected ) : ?>
		<div class="activate-splash">
			<img
				class="jetpack-logo"
				src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/jetpack_horizontal_logo.png' ); ?>"
				alt="<?php esc_attr_e( 'Jetpack logo', 'woocommerce' ); ?>"
			/>
			<img
				class="wcs-notice"
				src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/wcs-notice.png' ); ?>"
			/>
		</div>
	<?php else : ?>
		<img
			class="jetpack-logo"
			src="<?php echo esc_url( WC()->plugin_url() . '/assets/images/jetpack_vertical_logo.png' ); ?>"
			alt="<?php esc_attr_e( 'Jetpack logo', 'woocommerce' ); ?>"
		/>
	<?php endif; ?>

	<?php if ( $has_jetpack_error ) : ?>
		<p class="wc-setup-actions step">
			<a
				href="<?php echo esc_url( $this->get_next_step_link() ); ?>"
				class="button-primary button button-large"
			>
				<?php esc_html_e( 'Finish setting up your store', 'woocommerce' ); ?>
			</a>
		</p>
	<?php else : ?>
		<p class="jetpack-terms">
			<?php
				printf(
					wp_kses_post( __( 'By connecting your site you agree to our fascinating <a href="%1$s" target="_blank">Terms of Service</a> and to <a href="%2$s" target="_blank">share details</a> with WordPress.com', 'woocommerce' ) ),
					'https://wordpress.com/tos',
					'https://jetpack.com/support/what-data-does-jetpack-sync'
				);
			?>
		</p>
		<form method="post" class="activate-jetpack">
			<p class="wc-setup-actions step">
				<button type="submit" class="button-primary button button-large" value="<?php echo esc_attr( $button_text ); ?>"><?php echo esc_html( $button_text ); ?></button>
			</p>
			<input type="hidden" name="save_step" value="activate" />
			<?php wp_nonce_field( 'wc-setup' ); ?>
		</form>
		<?php if ( ! $jetpack_connected ) : ?>
			<h3 class="jetpack-reasons">
				<?php
					echo esc_html( $description ?
						__( "Bonus reasons you'll love Jetpack", 'woocommerce' ) :
						__( "Reasons you'll love Jetpack", 'woocommerce' )
					);
				?>
			</h3>
			<ul class="wc-wizard-features">
				<li class="wc-wizard-feature-item">
					<p class="wc-wizard-feature-name">
						<strong><?php esc_html_e( 'Better security', 'woocommerce' ); ?></strong>
					</p>
					<p class="wc-wizard-feature-description">
						<?php esc_html_e( 'Protect your store from unauthorized access.', 'woocommerce' ); ?>
					</p>
				</li>
				<li class="wc-wizard-feature-item">
					<p class="wc-wizard-feature-name">
						<strong><?php esc_html_e( 'Store stats', 'woocommerce' ); ?></strong>
					</p>
					<p class="wc-wizard-feature-description">
						<?php esc_html_e( 'Get insights on how your store is doing, including total sales, top products, and more.', 'woocommerce' ); ?>
					</p>
				</li>
				<li class="wc-wizard-feature-item">
					<p class="wc-wizard-feature-name">
						<strong><?php esc_html_e( 'Store monitoring', 'woocommerce' ); ?></strong>
					</p>
					<p class="wc-wizard-feature-description">
						<?php esc_html_e( 'Get an alert if your store is down for even a few minutes.', 'woocommerce' ); ?>
					</p>
				</li>
				<li class="wc-wizard-feature-item">
					<p class="wc-wizard-feature-name">
						<strong><?php esc_html_e( 'Product promotion', 'woocommerce' ); ?></strong>
					</p>
					<p class="wc-wizard-feature-description">
						<?php esc_html_e( "Share new items on social media the moment they're live in your store.", 'woocommerce' ); ?>
					</p>
				</li>
			</ul>
		<?php endif; ?>
	<?php endif; ?>
<?php
}