diff --git a/.github/ISSUE_TEMPLATE/2-External-issues.md b/.github/ISSUE_TEMPLATE/2-External-issues.md index 59f52cf6770..1a0543b7e98 100644 --- a/.github/ISSUE_TEMPLATE/2-External-issues.md +++ b/.github/ISSUE_TEMPLATE/2-External-issues.md @@ -1,6 +1,6 @@ --- name: "\U0001F47D External issues" -about: Please report WooCommerce REST API, WooCommerce Admin or WooCommerce Gutenberg Products Blocks issues directly to their respective repositories. +about: Please report WooCommerce Admin, WooCommerce Gutenberg Products Blocks or Action Scheduler issues directly to their respective repositories. title: '' labels: '' assignees: '' @@ -9,10 +9,12 @@ assignees: '' Please report issues for the following features directly to their respective repositories. -WooCommerce REST API: https://github.com/woocommerce/woocommerce-rest-api - WooCommerce Admin: https://github.com/woocommerce/woocommerce-admin WooCommerce Gutenberg Products Blocks: https://github.com/woocommerce/woocommerce-gutenberg-products-block Action Scheduler: https://github.com/woocommerce/action-scheduler + +WooCommerce REST API Docs: https://github.com/woocommerce/woocommerce-rest-api-docs + +WooCommerce Code Reference: https://github.com/woocommerce/code-reference diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000000..e338b86593f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v10 diff --git a/.travis.yml b/.travis.yml index f611e02c5ee..a9ed43a2179 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ jobs: php: 7.4 env: WP_VERSION=latest WP_MULTISITE=0 RUN_E2E=1 script: - - npm install - npm run build:assets - npm install jest --global - npm run docker:up @@ -71,7 +70,7 @@ install: else echo "xdebug.ini does not exist" fi - - nvm install 10 + - nvm install - npm install - composer install --no-dev - | diff --git a/assets/css/wc-setup.scss b/assets/css/wc-setup.scss index ccb0f2691d1..5a09594dd16 100644 --- a/assets/css/wc-setup.scss +++ b/assets/css/wc-setup.scss @@ -1,4 +1,6 @@ /* stylelint-disable no-descending-specificity */ + +/* @deprecated 4.6.0 */ body { margin: 65px auto 24px; box-shadow: none; diff --git a/assets/js/admin/wc-setup.js b/assets/js/admin/wc-setup.js index 168a425de7a..1484fda1f7b 100644 --- a/assets/js/admin/wc-setup.js +++ b/assets/js/admin/wc-setup.js @@ -1,6 +1,7 @@ /*global wc_setup_params */ /*global wc_setup_currencies */ /*global wc_base_state */ +/* @deprecated 4.6.0 */ jQuery( function( $ ) { function blockWizardUI() { $('.wc-setup-content').block({ diff --git a/bin/post-merge.sh b/bin/post-merge.sh index 67196fe5f18..687642a0b04 100755 --- a/bin/post-merge.sh +++ b/bin/post-merge.sh @@ -3,7 +3,10 @@ changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" runOnChange() { - echo "$changedFiles" | grep -q "$1" && eval "$2" + if echo "$changedFiles" | grep -q "$1" + then + eval "$2" + fi } runOnChange "package-lock.json" "npm install" diff --git a/bin/pre-push.sh b/bin/pre-push.sh index c8918ebe79e..1ae76885dfc 100755 --- a/bin/pre-push.sh +++ b/bin/pre-push.sh @@ -4,8 +4,8 @@ PROTECTED_BRANCH="master" REMOTE_REF=$(echo "$HUSKY_GIT_STDIN" | cut -d " " -f 3) if [ -n "$REMOTE_REF" ]; then - if [ "refs/heads/${PROTECTED_BRANCH}" == "$REMOTE_REF" ]; then - if [ "$TERM" == "dumb" ]; then + if [ "refs/heads/${PROTECTED_BRANCH}" = "$REMOTE_REF" ]; then + if [ "$TERM" = "dumb" ]; then >&2 echo "Sorry, you are unable to push to master using a GUI client! Please use git CLI." exit 1 fi diff --git a/changelog.txt b/changelog.txt index 0c2c10e5d7a..61ba71d5107 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ == Changelog == += 4.5.2 - 2020-09-14 = +* Fix - Revert the changes in filtering by attribute that were introduced in WooCommerce 4.4. #27625 +* Fix - Adjusted validation to allow for variations with "0" as an attribute value. #27633 + = 4.5.1 - 2020-09-09 = * Fix - Check for state and postcode fields only if required in `show_shipping`. #27628 diff --git a/composer.json b/composer.json index 3eafeab206f..f4b0ecbec4b 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ "pelago/emogrifier": "3.1.0", "psr/container": "1.0.0", "woocommerce/action-scheduler": "3.1.6", - "woocommerce/woocommerce-admin": "1.5.0", - "woocommerce/woocommerce-blocks": "3.1.0" + "woocommerce/woocommerce-admin": "1.6.0-beta.1", + "woocommerce/woocommerce-blocks": "3.4.0" }, "require-dev": { "phpunit/phpunit": "7.5.20", diff --git a/composer.lock b/composer.lock index f9f2f72e4b6..fb9c371fa02 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "11ae24e5fa6a835a12e6e4f853825392", + "content-hash": "ddfcf89afffda07ac78adfff8b311224", "packages": [ { "name": "automattic/jetpack-autoloader", @@ -468,20 +468,20 @@ }, { "name": "woocommerce/woocommerce-admin", - "version": "1.5.0", + "version": "1.6.0-beta.1", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-admin.git", - "reference": "b788329894265b4698c5ea997ce73a9f506d3e4c" + "reference": "a03cafd0a218451d83c42285b02f797555a7450e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/b788329894265b4698c5ea997ce73a9f506d3e4c", - "reference": "b788329894265b4698c5ea997ce73a9f506d3e4c", + "url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/a03cafd0a218451d83c42285b02f797555a7450e", + "reference": "a03cafd0a218451d83c42285b02f797555a7450e", "shasum": "" }, "require": { - "automattic/jetpack-autoloader": "^2.0.0", + "automattic/jetpack-autoloader": "^2.2.0", "composer/installers": "1.7.0", "php": ">=5.6|>=7.0" }, @@ -511,20 +511,20 @@ ], "description": "A modern, javascript-driven WooCommerce Admin experience.", "homepage": "https://github.com/woocommerce/woocommerce-admin", - "time": "2020-09-07T02:36:13+00:00" + "time": "2020-09-18T15:24:50+00:00" }, { "name": "woocommerce/woocommerce-blocks", - "version": "v3.1.0", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git", - "reference": "d8fdcb4fc90c392e672b0e75bb0b7fd81dac7436" + "reference": "d64a2616932f312ec4fd8f4e46195c3f9aca0000" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/d8fdcb4fc90c392e672b0e75bb0b7fd81dac7436", - "reference": "d8fdcb4fc90c392e672b0e75bb0b7fd81dac7436", + "url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/d64a2616932f312ec4fd8f4e46195c3f9aca0000", + "reference": "d64a2616932f312ec4fd8f4e46195c3f9aca0000", "shasum": "" }, "require": { @@ -558,7 +558,7 @@ "gutenberg", "woocommerce" ], - "time": "2020-07-29T15:45:19+00:00" + "time": "2020-09-15T12:10:40+00:00" } ], "packages-dev": [ diff --git a/i18n/states.php b/i18n/states.php index 0eb8fd94a14..4cfc20c1832 100644 --- a/i18n/states.php +++ b/i18n/states.php @@ -172,6 +172,20 @@ return array( ), 'BH' => array(), 'BI' => array(), + 'BJ' => array( // Benin states. + 'AL' => __( 'Alibori', 'woocommerce' ), + 'AK' => __( 'Atakora', 'woocommerce' ), + 'AQ' => __( 'Atlantique', 'woocommerce' ), + 'BO' => __( 'Borgou', 'woocommerce' ), + 'CO' => __( 'Collines', 'woocommerce' ), + 'KO' => __( 'Kouffo', 'woocommerce' ), + 'DO' => __( 'Donga', 'woocommerce' ), + 'LI' => __( 'Littoral', 'woocommerce' ), + 'MO' => __( 'Mono', 'woocommerce' ), + 'OU' => __( 'Ouémé', 'woocommerce' ), + 'PL' => __( 'Plateau', 'woocommerce' ), + 'ZO' => __( 'Zou', 'woocommerce' ), + ), 'BO' => array( // Bolivian states. 'B' => __( 'Chuquisaca', 'woocommerce' ), 'H' => __( 'Beni', 'woocommerce' ), @@ -475,7 +489,7 @@ return array( 'BA' => __( 'Baranya', 'woocommerce' ), 'BZ' => __( 'Borsod-Abaúj-Zemplén', 'woocommerce' ), 'BU' => __( 'Budapest', 'woocommerce' ), - 'CS' => __( 'Csongrád', 'woocommerce' ), + 'CS' => __( 'Csongrád-Csanád', 'woocommerce' ), 'FE' => __( 'Fejér', 'woocommerce' ), 'GS' => __( 'Győr-Moson-Sopron', 'woocommerce' ), 'HB' => __( 'Hajdú-Bihar', 'woocommerce' ), diff --git a/includes/admin/class-wc-admin-help.php b/includes/admin/class-wc-admin-help.php index aa5bc03a7bf..e2654e8888f 100644 --- a/includes/admin/class-wc-admin-help.php +++ b/includes/admin/class-wc-admin-help.php @@ -71,18 +71,6 @@ class WC_Admin_Help { ) ); - $screen->add_help_tab( - array( - 'id' => 'woocommerce_onboard_tab', - 'title' => __( 'Setup wizard', 'woocommerce' ), - 'content' => - '

' . __( 'Setup wizard', 'woocommerce' ) . '

' . - '

' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '

' . - '

' . __( 'Setup wizard', 'woocommerce' ) . '

', - - ) - ); - $screen->set_help_sidebar( '

' . __( 'For more information:', 'woocommerce' ) . '

' . '

' . __( 'About WooCommerce', 'woocommerce' ) . '

' . diff --git a/includes/admin/class-wc-admin-notices.php b/includes/admin/class-wc-admin-notices.php index e6057d91c46..a49dc780a38 100644 --- a/includes/admin/class-wc-admin-notices.php +++ b/includes/admin/class-wc-admin-notices.php @@ -28,7 +28,6 @@ class WC_Admin_Notices { * @var array */ private static $core_notices = array( - 'install' => 'install_notice', 'update' => 'update_notice', 'template_files' => 'template_file_check_notice', 'legacy_shipping' => 'legacy_shipping_notice', @@ -260,9 +259,11 @@ class WC_Admin_Notices { /** * If we have just installed, show a message with the install pages button. + * + * @deprecated 4.6.0 */ public static function install_notice() { - include dirname( __FILE__ ) . '/views/html-notice-install.php'; + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', __( 'Onboarding is maintained in WooCommerce Admin.', 'woocommerce' ) ); } /** diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index e2354239990..0a261b37cf8 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -28,10 +28,10 @@ class WC_Admin_Post_Types { * Constructor. */ public function __construct() { - include_once dirname( __FILE__ ) . '/class-wc-admin-meta-boxes.php'; + include_once __DIR__ . '/class-wc-admin-meta-boxes.php'; if ( ! function_exists( 'duplicate_post_plugin_activation' ) ) { - include_once 'class-wc-admin-duplicate-product.php'; + include_once __DIR__ . '/class-wc-admin-duplicate-product.php'; } // Load correct list table classes for current screen. @@ -94,15 +94,15 @@ class WC_Admin_Post_Types { switch ( $screen_id ) { case 'edit-shop_order': - include_once 'list-tables/class-wc-admin-list-table-orders.php'; + include_once __DIR__ . '/list-tables/class-wc-admin-list-table-orders.php'; $wc_list_table = new WC_Admin_List_Table_Orders(); break; case 'edit-shop_coupon': - include_once 'list-tables/class-wc-admin-list-table-coupons.php'; + include_once __DIR__ . '/list-tables/class-wc-admin-list-table-coupons.php'; $wc_list_table = new WC_Admin_List_Table_Coupons(); break; case 'edit-product': - include_once 'list-tables/class-wc-admin-list-table-products.php'; + include_once __DIR__ . '/list-tables/class-wc-admin-list-table-products.php'; $wc_list_table = new WC_Admin_List_Table_Products(); break; } diff --git a/includes/admin/class-wc-admin-settings.php b/includes/admin/class-wc-admin-settings.php index 20d3d1c1ddc..b36d9a889d6 100644 --- a/includes/admin/class-wc-admin-settings.php +++ b/includes/admin/class-wc-admin-settings.php @@ -49,15 +49,15 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) : include_once dirname( __FILE__ ) . '/settings/class-wc-settings-page.php'; - $settings[] = include 'settings/class-wc-settings-general.php'; - $settings[] = include 'settings/class-wc-settings-products.php'; - $settings[] = include 'settings/class-wc-settings-tax.php'; - $settings[] = include 'settings/class-wc-settings-shipping.php'; - $settings[] = include 'settings/class-wc-settings-payment-gateways.php'; - $settings[] = include 'settings/class-wc-settings-accounts.php'; - $settings[] = include 'settings/class-wc-settings-emails.php'; - $settings[] = include 'settings/class-wc-settings-integrations.php'; - $settings[] = include 'settings/class-wc-settings-advanced.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-general.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-products.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-tax.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-shipping.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-payment-gateways.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-accounts.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-emails.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-integrations.php'; + $settings[] = include __DIR__ . '/settings/class-wc-settings-advanced.php'; self::$settings = apply_filters( 'woocommerce_get_settings_pages', $settings ); } diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php index d5402a4bb12..14c11081d8c 100644 --- a/includes/admin/class-wc-admin-setup-wizard.php +++ b/includes/admin/class-wc-admin-setup-wizard.php @@ -6,6 +6,7 @@ * * @package WooCommerce\Admin * @version 2.6.0 + * @deprecated 4.6.0 */ use Automattic\Jetpack\Constants; @@ -59,19 +60,20 @@ class WC_Admin_Setup_Wizard { /** * Hook in tabs. + * + * @deprecated 4.6.0 */ public function __construct() { - if ( apply_filters( 'woocommerce_enable_setup_wizard', true ) && current_user_can( 'manage_woocommerce' ) ) { - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); - add_action( 'admin_init', array( $this, 'setup_wizard' ) ); - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); - } + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); } /** * Add admin menus/screens. + * + * @deprecated 4.6.0 */ public function admin_menus() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); add_dashboard_page( '', '', 'manage_options', 'wc-setup', '' ); } @@ -79,9 +81,11 @@ class WC_Admin_Setup_Wizard { * The theme "extra" should only be shown if the current user can modify themes * and the store doesn't already have a WooCommerce theme. * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_theme() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $support_woocommerce = current_theme_supports( 'woocommerce' ) && ! wc_is_wp_default_theme_active(); return ( @@ -95,8 +99,11 @@ class WC_Admin_Setup_Wizard { /** * The "automated tax" extra should only be shown if the current user can * install plugins and the store is in a supported country. + * + * @deprecated 4.6.0 */ protected function should_show_automated_tax() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); if ( ! current_user_can( 'install_plugins' ) ) { return false; } @@ -115,9 +122,11 @@ class WC_Admin_Setup_Wizard { * Should we show the MailChimp install option? * True only if the user can install plugins. * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_mailchimp() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); return current_user_can( 'install_plugins' ); } @@ -126,9 +135,11 @@ class WC_Admin_Setup_Wizard { * True only if the user can install plugins, * and up until the end date of the recommendation. * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_facebook() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); return current_user_can( 'install_plugins' ); } @@ -136,9 +147,11 @@ class WC_Admin_Setup_Wizard { * Is the WooCommerce Admin actively included in the WooCommerce core? * Based on presence of a basic WC Admin function. * + * @deprecated 4.6.0 * @return boolean */ protected function is_wc_admin_active() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); return function_exists( 'wc_admin_url' ); } @@ -149,9 +162,11 @@ class WC_Admin_Setup_Wizard { * * @see WC_Admin_Setup_Wizard::$wc_admin_plugin_minimum_wordpress_version * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_wc_admin() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $wordpress_minimum_met = version_compare( get_bloginfo( 'version' ), $this->wc_admin_plugin_minimum_wordpress_version, '>=' ); return current_user_can( 'install_plugins' ) && $wordpress_minimum_met && ! $this->is_wc_admin_active(); } @@ -159,9 +174,11 @@ class WC_Admin_Setup_Wizard { /** * Should we show the new WooCommerce Admin onboarding experience? * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_wc_admin_onboarding() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); // As of WooCommerce 4.1, all new sites should use the latest OBW from wc-admin package. // This filter will allow for forcing the old wizard while we migrate e2e tests. return ! apply_filters( 'woocommerce_setup_wizard_force_legacy', false ); @@ -171,9 +188,11 @@ class WC_Admin_Setup_Wizard { * Should we display the 'Recommended' step? * True if at least one of the recommendations will be displayed. * + * @deprecated 4.6.0 * @return boolean */ protected function should_show_recommended_step() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); return $this->should_show_theme() || $this->should_show_automated_tax() || $this->should_show_mailchimp() @@ -185,82 +204,20 @@ class WC_Admin_Setup_Wizard { * Register/enqueue scripts and styles for the Setup Wizard. * * Hooked onto 'admin_enqueue_scripts'. + * + * @deprecated 4.6.0 */ public function enqueue_scripts() { - // Whether or not there is a pending background install of Jetpack. - $pending_jetpack = ! class_exists( 'Jetpack' ) && get_option( 'woocommerce_setup_background_installing_jetpack' ); - $suffix = Constants::is_true( 'SCRIPT_DEBUG' ) ? '' : '.min'; - $version = Constants::get_constant( 'WC_VERSION' ); - - 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.6' ); - wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWoo' ), $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(), $version ); - wp_enqueue_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array( 'dashicons', 'install' ), $version ); - wp_style_add_data( 'wc-setup', 'rtl', 'replace' ); - - wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup' . $suffix . '.js', array( 'jquery', 'wc-enhanced-select', 'jquery-blockui', 'wp-util', 'jquery-tiptip', 'backbone', 'wc-backbone-modal' ), $version ); - wp_localize_script( - 'wc-setup', - 'wc_setup_params', - array( - 'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no', - 'states' => WC()->countries->get_states(), - 'postcodes' => $this->get_postcodes(), - 'current_step' => isset( $this->steps[ $this->step ] ) ? $this->step : false, - 'i18n' => array( - 'extra_plugins' => array( - 'payment' => array( - 'stripe_create_account' => __( 'Stripe setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ), - 'ppec_paypal_reroute_requests' => __( 'PayPal setup is powered by Jetpack and WooCommerce Services.', 'woocommerce' ), - 'stripe_create_account,ppec_paypal_reroute_requests' => __( 'Stripe and PayPal setup are powered by Jetpack and WooCommerce Services.', 'woocommerce' ), - ), - ), - ), - ) - ); - } - - /** - * Helper method to get postcode configurations from `WC()->countries->get_country_locale()`. - * We don't use `wp_list_pluck` because it will throw notices when postcode configuration is not defined for a country. - * - * @return array - */ - private function get_postcodes() { - $locales = WC()->countries->get_country_locale(); - $postcodes = array(); - foreach ( $locales as $country_code => $locale ) { - if ( isset( $locale['postcode'] ) ) { - $postcodes[ $country_code ] = $locale['postcode']; - } - } - return $postcodes; + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); } /** * Show the setup wizard. + * + * @deprecated 4.6.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; } @@ -346,9 +303,12 @@ class WC_Admin_Setup_Wizard { * @return string URL for next step if a next step exists. * Admin URL if it's the last step. * Empty string on failure. + * + * @deprecated 4.6.0 * @since 3.0.0 */ public function get_next_step_link( $step = '' ) { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); if ( ! $step ) { $step = $this->step; } @@ -368,8 +328,11 @@ class WC_Admin_Setup_Wizard { /** * Setup Wizard Header. + * + * @deprecated 4.6.0 */ public function setup_wizard_header() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); // same as default WP from wp-admin/admin-header.php. $wp_version_class = 'branch-' . str_replace( array( '.', ',' ), '-', floatval( get_bloginfo( 'version' ) ) ); @@ -393,8 +356,11 @@ class WC_Admin_Setup_Wizard { /** * Setup Wizard Footer. + * + * @deprecated 4.6.0 */ public function setup_wizard_footer() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $current_step = $this->step; ?> @@ -410,8 +376,11 @@ class WC_Admin_Setup_Wizard { /** * Output the steps. + * + * @deprecated 4.6.0 */ public function setup_wizard_steps() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $output_steps = $this->steps; $selected_features = array_filter( $this->wc_setup_activate_get_feature_list() ); @@ -452,8 +421,11 @@ class WC_Admin_Setup_Wizard { /** * Output the content for the current step. + * + * @deprecated 4.6.0 */ public function setup_wizard_content() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); echo '
'; if ( ! empty( $this->steps[ $this->step ]['view'] ) ) { call_user_func( $this->steps[ $this->step ]['view'], $this ); @@ -463,8 +435,11 @@ class WC_Admin_Setup_Wizard { /** * Display's a prompt for users to try out the new improved WooCommerce onboarding experience in WooCommerce Admin. + * + * @deprecated 4.6.0 */ public function wc_setup_new_onboarding() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); ?>

@@ -487,46 +462,11 @@ class WC_Admin_Setup_Wizard { /** * Installs WooCommerce admin and redirects to the new onboarding experience. + * + * @deprecated 4.6.0 */ public function wc_setup_new_onboarding_save() { - check_admin_referer( 'wc-setup' ); - - if ( $this->is_wc_admin_active() ) { - $this->wc_setup_redirect_to_wc_admin_onboarding(); - } - - WC_Install::background_installer( - 'woocommerce-admin', - array( - 'name' => __( 'WooCommerce Admin', 'woocommerce' ), - 'repo-slug' => 'woocommerce-admin', - ) - ); - - // The plugin was not successfully installed, so continue with normal setup. - if ( ! $this->is_wc_admin_active() ) { - wp_safe_redirect( esc_url_raw( $this->get_next_step_link() ) ); - exit; - } - - $this->wc_setup_redirect_to_wc_admin_onboarding(); - } - - /** - * Redirects to the onboarding wizard in WooCommerce Admin. - */ - private function wc_setup_redirect_to_wc_admin_onboarding() { - if ( ! $this->is_wc_admin_active() ) { - return; - } - - // Renables the wizard. - $profile_updates = array( 'completed' => false ); - $onboarding_data = get_option( 'woocommerce_onboarding_profile', array() ); - update_option( 'woocommerce_onboarding_profile', array_merge( $onboarding_data, $profile_updates ) ); - - wp_safe_redirect( wc_admin_url( '&enable_onboarding=1' ) ); - exit; + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); } /** @@ -534,6 +474,7 @@ class WC_Admin_Setup_Wizard { * Location, product type, page setup, and tracking opt-in. */ public function wc_setup_store_setup() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); $address = WC()->countries->get_base_address(); $address_2 = WC()->countries->get_base_address_2(); $city = WC()->countries->get_base_city(); @@ -662,8 +603,11 @@ class WC_Admin_Setup_Wizard { /** * Template for the usage tracking modal. + * + * @deprecated 4.6.0 */ public function tracking_modal() { + _deprecated_function( __CLASS__ . '::' . __FUNCTION__, '4.6.0', 'Onboarding is maintained in WooCommerce Admin.' ); ?>