countries->get_base_country(); // https://developers.taxjar.com/api/reference/#countries $tax_supported_countries = array_merge( array( 'US', 'CA', 'AU' ), WC()->countries->get_european_union_countries() ); return in_array( $country_code, $tax_supported_countries ); } /** * Show the setup wizard. */ public function setup_wizard() { if ( empty( $_GET['page'] ) || 'wc-setup' !== $_GET['page'] ) { return; } $default_steps = array( 'store_setup' => array( 'name' => __( 'Store setup', 'woocommerce' ), 'view' => array( $this, 'wc_setup_store_setup' ), 'handler' => array( $this, 'wc_setup_store_setup_save' ), ), 'payments' => array( 'name' => __( 'Payments', 'woocommerce' ), 'view' => array( $this, 'wc_setup_payments' ), 'handler' => array( $this, 'wc_setup_payments_save' ), ), 'shipping' => array( 'name' => __( 'Shipping', 'woocommerce' ), 'view' => array( $this, 'wc_setup_shipping' ), 'handler' => array( $this, 'wc_setup_shipping_save' ), ), 'extras' => array( 'name' => __( 'Extras', 'woocommerce' ), 'view' => array( $this, 'wc_setup_extras' ), 'handler' => array( $this, 'wc_setup_extras_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 extras step if this store/user isn't eligible for them if ( ! $this->should_show_theme_extra() && ! $this->should_show_automated_tax_extra() ) { unset( $default_steps['extras'] ); } // Hide shipping step if the store is selling digital products only. if ( 'virtual' === get_option( 'woocommerce_product_type' ) ) { unset( $default_steps['shipping'] ); } // Whether or not there is a pending background install of Jetpack $pending_jetpack = ! class_exists( 'Jetpack' ) && get_option( 'woocommerce_setup_queued_jetpack_install' ); $this->steps = apply_filters( 'woocommerce_setup_wizard_steps', $default_steps ); $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) ); $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_register_script( 'jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true ); wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full' . $suffix . '.js', array( 'jquery' ), '1.0.0' ); wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), WC_VERSION ); wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array( 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ), 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce' ), 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ), 'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'woocommerce' ), 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'woocommerce' ), 'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'woocommerce' ), 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'woocommerce' ), 'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'woocommerce' ), 'i18n_load_more' => _x( 'Loading more results…', 'enhanced select', 'woocommerce' ), 'i18n_searching' => _x( 'Searching…', 'enhanced select', 'woocommerce' ), 'ajax_url' => admin_url( 'admin-ajax.php' ), 'search_products_nonce' => wp_create_nonce( 'search-products' ), 'search_customers_nonce' => wp_create_nonce( 'search-customers' ), ) ); wp_enqueue_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION ); wp_enqueue_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array( 'dashicons', 'install' ), WC_VERSION ); wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup' . $suffix . '.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui', 'wp-util' ), WC_VERSION ); wp_localize_script( 'wc-setup', 'wc_setup_params', array( 'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no', ) ); if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { call_user_func( $this->steps[ $this->step ]['handler'], $this ); } ob_start(); $this->setup_wizard_header(); $this->setup_wizard_steps(); $this->setup_wizard_content(); $this->setup_wizard_footer(); exit; } /** * Get the URL for the next step's screen. * @param string step slug (default: current step) * @return string URL for next step if a next step exists. * Admin URL if it's the last step. * Empty string on failure. * @since 3.0.0 */ public function get_next_step_link( $step = '' ) { if ( ! $step ) { $step = $this->step; } $keys = array_keys( $this->steps ); if ( end( $keys ) === $step ) { return admin_url(); } $step_index = array_search( $step, $keys ); if ( false === $step_index ) { return ''; } return add_query_arg( 'step', $keys[ $step_index + 1 ] ); } /** * Setup Wizard Header. */ public function setup_wizard_header() { ?> > <?php esc_html_e( 'WooCommerce › Setup Wizard', 'woocommerce' ); ?>

WooCommerce

step ) : ?> step ) : ?> step ) : ?> steps; ?>
    $step ) : ?>
'; call_user_func( $this->steps[ $this->step ]['view'], $this ); echo ''; } /** * Initial "store setup" step. * Location, product type, page setup, and tracking opt-in. */ public function wc_setup_store_setup() { $address = WC()->countries->get_base_address(); $address_2 = WC()->countries->get_base_address_2(); $city = WC()->countries->get_base_city(); $state = WC()->countries->get_base_state(); $country = WC()->countries->get_base_country(); $postcode = WC()->countries->get_base_postcode(); $currency = get_option( 'woocommerce_currency', 'GBP' ); $product_type = get_option( 'woocommerce_product_type' ); if ( empty( $country ) ) { $user_location = WC_Geolocation::geolocate_ip(); $country = $user_location['country']; $state = $user_location['state']; } elseif ( empty( $state ) ) { $state = '*'; } ?>

" name="save_step" />

plugin_path() . '/i18n/locale-info.php' ); $country = WC()->countries->get_base_country(); // Set currency formatting options based on chosen location and currency if ( isset( $locale_info[ $country ] ) && $locale_info[ $country ]['currency_code'] === $currency_code ) { update_option( 'woocommerce_currency_pos', $locale_info[ $country ]['currency_pos'] ); update_option( 'woocommerce_price_decimal_sep', $locale_info[ $country ]['decimal_sep'] ); update_option( 'woocommerce_price_num_decimals', $locale_info[ $country ]['num_decimals'] ); update_option( 'woocommerce_price_thousand_sep', $locale_info[ $country ]['thousand_sep'] ); } if ( $tracking ) { update_option( 'woocommerce_allow_tracking', 'yes' ); WC_Tracker::send_tracking_data( true ); } else { update_option( 'woocommerce_allow_tracking', 'no' ); } WC_Install::create_pages(); wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Tout WooCommerce Services for North American stores. */ protected function wc_setup_wcs_tout() { $base_location = wc_get_base_location(); if ( false === $base_location['country'] ) { $base_location = WC_Geolocation::geolocate_ip(); } if ( ! in_array( $base_location['country'], array( 'US', 'CA' ), true ) ) { return; } $default_content = array( 'title' => __( 'Enable WooCommerce Shipping (recommended)', 'woocommerce' ), 'description' => __( 'Print labels and get discounted USPS shipping rates, right from your WooCommerce dashboard. Powered by WooCommerce Services.', 'woocommerce' ), ); switch ( $base_location['country'] ) { case 'CA': $local_content = array( 'title' => __( 'Enable WooCommerce Shipping (recommended)', 'woocommerce' ), 'description' => __( 'Display live rates from Canada Post at checkout to make shipping a breeze. Powered by WooCommerce Services.', 'woocommerce' ), ); break; default: $local_content = array(); } $content = wp_parse_args( $local_content, $default_content ); ?> install_plugin( 'jetpack', array( 'file' => 'jetpack/jetpack.php', 'name' => __( 'Jetpack', 'woocommerce' ), 'repo-slug' => 'jetpack', ), ! $now ); if ( ! $now ) { update_option( 'woocommerce_setup_queued_jetpack_install', true ); } } /** * Helper method to install WooCommerce Services and its Jetpack dependency. */ protected function install_woocommerce_services() { $this->install_jetpack(); $this->install_plugin( 'woocommerce-services', array( 'file' => 'woocommerce-services/woocommerce-services.php', 'name' => __( 'WooCommerce Services', 'woocommerce' ), 'repo-slug' => 'woocommerce-services', ) ); } /** * Get the WCS shipping carrier for a given country code. * * Can also be used to determine if WCS supports a given country. * * @param $country_code * @return bool|string Carrier name if supported, boolean False otherwise. */ protected function get_wcs_shipping_carrier( $country_code ) { switch ( $country_code ) { case 'US': return 'USPS'; case 'CA': return 'Canada Post'; default: return false; } } /** * Get shipping methods based on country code. * * @param $country_code * @return array */ protected function get_wizard_shipping_methods( $country_code ) { $shipping_methods = array( 'live_rates' => array( 'name' => __( 'Live Rates', 'woocommerce' ), 'description' => __( 'Shipping rates updated in realtime. Powered by Jetpack.', 'woocommerce' ), ), 'flat_rate' => array( 'name' => __( 'Flat Rate', 'woocommerce' ), 'description' => __( 'Set a fixed price to cover shipping costs.', 'woocommerce' ), 'settings' => array( 'cost' => array( 'type' => 'text', 'description' => __( 'What would you like to charge for flat rate shipping?', 'woocommerce' ), ), ), ), 'free_shipping' => array( 'name' => __( 'Free Shipping', 'woocommerce' ), 'description' => __( "Don't charge for shipping.", 'woocommerce' ), ), ); $live_rate_carrier = $this->get_wcs_shipping_carrier( $country_code ); if ( false === $live_rate_carrier || ! current_user_can('install_plugins') ) { unset( $shipping_methods['live_rates'] ); } return $shipping_methods; } /** * Render the available shipping methods for a given country code. * * @param string $country_code * @param string $input_prefix */ protected function shipping_method_selection_form( $country_code, $input_prefix ) { $live_rate_carrier = $this->get_wcs_shipping_carrier( $country_code ); $selected = $live_rate_carrier ? 'live_rates' : 'flat_rate'; $shipping_methods = $this->get_wizard_shipping_methods( $country_code ); ?>
$method ) : ?>

>

$method ) : ?>
> $setting ) : ?>

countries->get_base_country(); $country_name = WC()->countries->countries[ $country_code ]; $wcs_carrier = $this->get_wcs_shipping_carrier( $country_code ); // TODO: determine how to handle existing shipping zones (or choose not to) if ( false === $dimension_unit || false === $weight_unit ) { if ( 'US' === $country_code ) { $dimension_unit = 'in'; $weight_unit = 'oz'; } else { $dimension_unit = 'cm'; $weight_unit = 'kg'; } } if ( $wcs_carrier ) { $intro_text = sprintf( /* translators: %1$s: country name, %2$s: shipping carrier name */ __( "You're all set up to ship anywhere in the %1\$s, and outside of it. We recommend using live rates to get accurate %2\$s shipping prices to cover the cost of order fulfillment. Live rates are powered by WooCommerce Services and Jetpack.", 'woocommerce' ), $country_name, $wcs_carrier ); } else { $intro_text = sprintf( /* translators: %s: country name */ __( "You can choose which countries you'll be shipping to and with which methods. We've started you up with shipping to %s and the rest of the world.", 'woocommerce' ), $country_name ); } ?>

get_next_step_link() ) ); exit; } // Install WooCommerce Services if live rates were selected if ( ( $setup_domestic && 'live_rates' === $domestic_method ) || ( $setup_intl && 'live_rates' === $intl_method ) ) { $this->install_woocommerce_services(); } /* * If enabled, create a shipping zone containing the country the * store is located in, with the selected method preconfigured. */ if ( $setup_domestic ) { $country = WC()->countries->get_base_country(); $zone = new WC_Shipping_Zone( null ); $zone->set_zone_order( 0 ); $zone->add_location( $country, 'country' ); if ( 'live_rates' === $domestic_method ) { // Signal WooCommerce Services to setup the domestic zone. update_option( 'woocommerce_setup_domestic_live_rates_zone', true, 'no' ); } else { $instance_id = $zone->add_shipping_method( $domestic_method ); } $zone->save(); // Save chosen shipping method settings (using REST controller for convenience) if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) { $method_controller = new WC_REST_Shipping_Zone_Methods_Controller(); $method_controller->update_item( array( 'zone_id' => $zone->get_id(), 'instance_id' => $instance_id, 'settings' => $_POST['shipping_zones']['domestic'][ $domestic_method ], ) ); } } // If enabled, set the selected method for the "rest of world" zone. if ( $setup_intl ) { if ( 'live_rates' === $intl_method ) { // Signal WooCommerce Services to setup the international zone. update_option( 'woocommerce_setup_intl_live_rates_zone', true, 'no' ); } else { $zone = new WC_Shipping_Zone( 0 ); $instance_id = $zone->add_shipping_method( $intl_method ); $zone->save(); } // Save chosen shipping method settings (using REST controller for convenience) if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) { $method_controller = new WC_REST_Shipping_Zone_Methods_Controller(); $method_controller->update_item( array( 'zone_id' => $zone->get_id(), 'instance_id' => $instance_id, 'settings' => $_POST['shipping_zones']['intl'][ $intl_method ], ) ); } } // Notify the user that no shipping methods are configured if ( ! $setup_domestic && ! $setup_intl ) { WC_Admin_Notices::add_notice( 'no_shipping_methods' ); } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * https://stripe.com/global */ protected function is_stripe_supported_country( $country_code ) { $stripe_supported_countries = array( 'AU' => __( 'Australia', 'woocommerce' ), 'AT' => __( 'Austria', 'woocommerce' ), 'BE' => __( 'Belgium', 'woocommerce' ), 'CA' => __( 'Canada', 'woocommerce' ), 'DK' => __( 'Denmark', 'woocommerce' ), 'FI' => __( 'Finland', 'woocommerce' ), 'FR' => __( 'France', 'woocommerce' ), 'DE' => __( 'Germany', 'woocommerce' ), 'HK' => __( 'Hong Kong', 'woocommerce' ), 'IE' => __( 'Ireland', 'woocommerce' ), 'JP' => __( 'Japan', 'woocommerce' ), 'LU' => __( 'Luxembourg', 'woocommerce' ), 'NL' => __( 'Netherlands', 'woocommerce' ), 'NZ' => __( 'New Zealand', 'woocommerce' ), 'NO' => __( 'Norway', 'woocommerce' ), 'SG' => __( 'Singapore', 'woocommerce' ), 'ES' => __( 'Spain', 'woocommerce' ), 'SE' => __( 'Sweden', 'woocommerce' ), 'CH' => __( 'Switzerland', 'woocommerce' ), 'GB' => __( 'United Kingdom (UK)', 'woocommerce' ), 'US' => __( 'United States (US)', 'woocommerce' ), ); return array_key_exists( $country_code, $stripe_supported_countries ); } /** * Simple array of "in cart" gateways to show in wizard. * @return array */ protected function get_wizard_in_cart_payment_gateways() { $country = WC()->countries->get_base_country(); $can_stripe = $this->is_stripe_supported_country( $country ); $gateways = array( 'stripe' => array( 'name' => __( 'Stripe', 'woocommerce' ), 'image' => WC()->plugin_url() . '/assets/images/stripe.png', 'description' => sprintf( __( '

Accept all major debit and credit cards from customers in 135+ countries on your site. Learn more about Stripe.

Fee: 2.9%% + 30¢ per transaction

', 'woocommerce' ), 'https://wordpress.org/plugins/woocommerce-gateway-stripe/' ), 'class' => $can_stripe ? 'checked' : '', 'repo-slug' => 'woocommerce-gateway-stripe', 'settings' => array( 'email' => array( 'label' => __( 'Stripe email address', 'woocommerce' ), 'type' => 'email', 'value' => get_option( 'admin_email' ), 'placeholder' => __( 'Stripe email address', 'woocommerce' ), ), ), 'enabled' => $can_stripe, 'featured' => true, ), 'braintree_paypal' => array( 'name' => __( 'PayPal by Braintree', 'woocommerce' ), 'image' => WC()->plugin_url() . '/assets/images/paypal-braintree.png', 'description' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ) . ' ' . __( 'Learn more about PayPal', 'woocommerce' ) . '.', 'class' => 'in-cart', 'repo-slug' => 'woocommerce-gateway-paypal-powered-by-braintree', ), 'ppec_paypal' => array( 'name' => __( 'PayPal Express Checkout', 'woocommerce' ), 'image' => WC()->plugin_url() . '/assets/images/paypal.png', 'description' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ) . ' ' . __( 'Learn more about PayPal', 'woocommerce' ) . '', 'class' => 'in-cart', 'repo-slug' => 'woocommerce-gateway-paypal-express-checkout', ), 'paypal' => array( 'name' => __( 'PayPal Standard', 'woocommerce' ), 'description' => __( 'Accept payments via PayPal using account balance or credit card.', 'woocommerce' ), 'image' => '', 'class' => 'in-cart', 'settings' => array( 'email' => array( 'label' => __( 'PayPal email address', 'woocommerce' ), 'type' => 'email', 'value' => get_option( 'admin_email' ), 'placeholder' => __( 'PayPal email address', 'woocommerce' ), ), ), ), ); if ( 'US' === $country ) { unset( $gateways['ppec_paypal'] ); } else { unset( $gateways['braintree_paypal'] ); } if ( ! current_user_can( 'install_plugins' ) ) { unset( $gateways['braintree_paypal'] ); unset( $gateways['ppec_paypal'] ); unset( $gateways['stripe'] ); } return $gateways; } /** * Simple array of "manual" gateways to show in wizard. * @return array */ protected function get_wizard_manual_payment_gateways() { $gateways = array( 'cheque' => array( 'name' => _x( 'Check payments', 'Check payment method', 'woocommerce' ), 'description' => __( 'A simple offline gateway that lets you accept a check as method of payment.', 'woocommerce' ), 'image' => '', 'class' => '', ), 'bacs' => array( 'name' => __( 'Bank transfer (BACS) payments', 'woocommerce' ), 'description' => __( 'A simple offline gateway that lets you accept BACS payment.', 'woocommerce' ), 'image' => '', 'class' => '', ), 'cod' => array( 'name' => __( 'Cash on delivery', 'woocommerce' ), 'description' => __( 'A simple offline gateway that lets you accept cash on delivery.', 'woocommerce' ), 'image' => '', 'class' => '', ), ); return $gateways; } /** * Display service item in list. */ public function display_service_item( $item_id, $item_info ) { $enabled = isset( $item_info['enabled'] ) && $item_info['enabled']; ?>
  • <?php echo esc_attr( $item_info['name'] ); ?>

    $setting ) : ?>
    />
  • is_featured_service( $service ); } /** * Payments Step. */ public function wc_setup_payments() { $featured_gateways = array_filter( $this->get_wizard_in_cart_payment_gateways(), array( $this, 'is_featured_service' ) ); $in_cart_gateways = array_filter( $this->get_wizard_in_cart_payment_gateways(), array( $this, 'is_not_featured_service' ) ); $manual_gateways = $this->get_wizard_manual_payment_gateways(); $country = WC()->countries->get_base_country(); $can_stripe = $this->is_stripe_supported_country( $country ); ?>

    Additional payment methods can be installed later and managed from the checkout settings screen.', 'woocommerce' ), esc_url( admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) ), esc_url( admin_url( 'admin.php?page=wc-settings&tab=checkout' ) ) ); ?>

    install_woocommerce_services(); } $gateways = $this->get_wizard_in_cart_payment_gateways(); foreach ( $gateways as $gateway_id => $gateway ) { // If repo-slug is defined, download and install plugin from .org. if ( ! empty( $gateway['repo-slug'] ) && ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ) { $this->install_plugin( $gateway_id, $gateway ); } $settings_key = 'woocommerce_' . $gateway_id . '_settings'; $settings = array_filter( (array) get_option( $settings_key, array() ) ); $settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no'; if ( ! empty( $gateway['settings'] ) ) { foreach ( $gateway['settings'] as $setting_id => $setting ) { $settings[ $setting_id ] = wc_clean( $_POST[ $gateway_id . '_' . $setting_id ] ); } } update_option( $settings_key, $settings ); } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Extras. */ public function wc_setup_extras() { ?>

    should_show_theme_extra() ) : ?> should_show_automated_tax_extra() ) : ?>

    install_woocommerce_services(); // Signal WooCommerce Services to setup automated taxes. update_option( 'woocommerce_setup_automated_taxes', true ); } if ( $install_storefront ) { wp_schedule_single_event( time() + 1, 'woocommerce_theme_background_installer', array( 'storefront' ) ); } wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); exit; } /** * Go to the next step if Jetpack was connected. */ protected function wc_setup_activate_actions() { if ( isset( $_GET['from'] ) && 'wpcom' === $_GET['from'] && class_exists( 'Jetpack' ) && Jetpack::is_active() ) { wp_redirect( esc_url_raw( remove_query_arg( 'from', $this->get_next_step_link() ) ) ); exit; } } /** * Activate step. */ public function wc_setup_activate() { $this->wc_setup_activate_actions(); $show_description = false; $services = []; $stripe_settings = get_option( 'woocommerce_stripe_settings', false ); if ( $stripe_settings && ! empty( $stripe_settings[ 'email' ] ) ) { $show_description = true; array_push( $services, __( 'Stripe payments', 'woocommerce' ) ); } if ( get_option( 'woocommerce_setup_automated_taxes', false ) ) { $show_description = true; array_push( $services, __( 'automated taxes', 'woocommerce' ) ); } if ( get_option( 'woocommerce_setup_domestic_live_rates_zone', false ) || get_option( 'woocommerce_setup_intl_live_rates_zone', false ) ) { $show_description = true; array_push( $services, __( 'live rates', 'woocommerce' ) ); array_push( $services, __( 'discounted shipping labels', 'woocommerce' ) ); } if ( $show_description ) { if ( 1 === count( $services ) ) { $services_list = $services[ 0 ]; } else { $services_list = implode( ', ', array_slice( $services, 0, -1 ) ); $services_list = sprintf( __( '%s and %s', 'woocommerce' ), $services_list, array_slice( $services, -1 )[ 0 ] ); } $description = sprintf( __( "Your store's almost ready. Connect to Jetpack for full access to %s.", 'woocommerce' ), $services_list ); } ?>

    Jetpack

    'wpcom', 'activate_error' => false, ) ) ); $connection_url = Jetpack::init()->build_connect_url( true, $redirect_url, 'woocommerce' ); wp_redirect( esc_url_raw( $connection_url ) ); exit; } /** * Final step. */ public function wc_setup_ready() { // We've made it! Don't prompt the user to run the wizard again. WC_Admin_Notices::remove_notice( 'install' ); $current_user = wp_get_current_user(); $user_email = $current_user->user_email; $videos_url = 'https://docs.woocommerce.com/document/woocommerce-guided-tour-videos/?utm_source=setupwizard&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin'; $docs_url = 'https://docs.woocommerce.com/documentation/plugins/woocommerce/getting-started/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'; $help_text = sprintf( /* translators: %1$s: link to videos, %2$s: link to docs */ __( 'Watch our guided tour videos to learn more about WooCommerce, and visit WooCommerce.com to learn more about getting started.' ), $videos_url, $docs_url ); ?>