From d43e45576d74b1fb6274b8648528f7d892e56c9d Mon Sep 17 00:00:00 2001 From: Sam Seay Date: Wed, 25 Nov 2020 08:36:04 +1300 Subject: [PATCH] Revert the smart tax defaults work of woocommerce/woocommerce-admin#4594. (https://github.com/woocommerce/woocommerce-admin/pull/5720) --- .../client/profile-wizard/index.js | 13 +-- .../src/Features/Onboarding.php | 2 - .../src/Features/OnboardingAutomateTaxes.php | 80 ------------------- 3 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 plugins/woocommerce-admin/src/Features/OnboardingAutomateTaxes.php diff --git a/plugins/woocommerce-admin/client/profile-wizard/index.js b/plugins/woocommerce-admin/client/profile-wizard/index.js index 7ea6fb5bdc9..ad4e61be96c 100644 --- a/plugins/woocommerce-admin/client/profile-wizard/index.js +++ b/plugins/woocommerce-admin/client/profile-wizard/index.js @@ -214,7 +214,6 @@ class ProfileWizard extends Component { updateNote, updateProfileItems, connectToJetpack, - clearTaskCache, } = this.props; recordEvent( 'storeprofiler_complete' ); @@ -232,8 +231,6 @@ class ProfileWizard extends Component { } updateProfileItems( { completed: true } ).then( () => { - clearTaskCache(); - const homescreenUrl = new URL( getNewPath( {}, '/', {} ), window.location.href @@ -338,16 +335,9 @@ export default compose( } = dispatch( PLUGINS_STORE_NAME ); const { updateNote } = dispatch( NOTES_STORE_NAME ); const { updateOptions } = dispatch( OPTIONS_STORE_NAME ); - const { - updateProfileItems, - invalidateResolutionForStoreSelector, - } = dispatch( ONBOARDING_STORE_NAME ); + const { updateProfileItems } = dispatch( ONBOARDING_STORE_NAME ); const { createNotice } = dispatch( 'core/notices' ); - const clearTaskCache = () => { - invalidateResolutionForStoreSelector( 'getTasksStatus' ); - }; - const connectToJetpack = ( failureRedirect ) => { connectToJetpackWithFailureRedirect( failureRedirect, @@ -362,7 +352,6 @@ export default compose( updateNote, updateOptions, updateProfileItems, - clearTaskCache, }; } ), window.wcSettings.plugins diff --git a/plugins/woocommerce-admin/src/Features/Onboarding.php b/plugins/woocommerce-admin/src/Features/Onboarding.php index 4dc15ac1cb9..9f786006c59 100644 --- a/plugins/woocommerce-admin/src/Features/Onboarding.php +++ b/plugins/woocommerce-admin/src/Features/Onboarding.php @@ -9,7 +9,6 @@ namespace Automattic\WooCommerce\Admin\Features; use \Automattic\WooCommerce\Admin\Loader; use \Automattic\WooCommerce\Admin\PluginsHelper; use \Automattic\WooCommerce\Admin\Features\OnboardingSetUpShipping; -use \Automattic\WooCommerce\Admin\Features\OnboardingAutomateTaxes; /** * Contains backend logic for the onboarding profile and checklist feature. @@ -68,7 +67,6 @@ class Onboarding { // Hook up dependent classes. new OnboardingSetUpShipping(); - new OnboardingAutomateTaxes(); } /** diff --git a/plugins/woocommerce-admin/src/Features/OnboardingAutomateTaxes.php b/plugins/woocommerce-admin/src/Features/OnboardingAutomateTaxes.php deleted file mode 100644 index 4a2493e8e9d..00000000000 --- a/plugins/woocommerce-admin/src/Features/OnboardingAutomateTaxes.php +++ /dev/null @@ -1,80 +0,0 @@ -external_user_id ); - } - - if ( class_exists( '\WC_Connect_Loader' ) ) { - $wcs_version = \WC_Connect_Loader::get_wcs_version(); - } - - if ( class_exists( '\WC_Connect_Options' ) ) { - $wcs_tos_accepted = \WC_Connect_Options::get_option( 'tos_accepted' ); - } - - if ( $jetpack_connected && $wcs_version && $wcs_tos_accepted && self::automated_tax_is_supported() ) { - update_option( 'wc_connect_taxes_enabled', 'yes' ); - update_option( 'woocommerce_calc_taxes', 'yes' ); - self::track_tax_automation(); - ConfirmTaxSettings::possibly_add_note(); - } - } - - /** - * Check if automated taxes are supported. - */ - private static function automated_tax_is_supported() { - return in_array( WC()->countries->get_base_country(), OnboardingTasks::get_automated_tax_supported_countries(), true ); - } - - /** - * Track when a user has tax automation enabled. - */ - private static function track_tax_automation() { - wc_admin_record_tracks_event( 'tasklist_task_completed', array( 'task_name' => 'tax_automated' ) ); - } -}