Revert the smart tax defaults work of woocommerce/woocommerce-admin#4594. (https://github.com/woocommerce/woocommerce-admin/pull/5720)
This commit is contained in:
parent
bbbc945b3e
commit
d43e45576d
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Onboarding - set up automated tax calculation.
|
||||
*
|
||||
* @package Woocommerce Admin
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks;
|
||||
use Automattic\WooCommerce\Admin\Notes\ConfirmTaxSettings;
|
||||
|
||||
/**
|
||||
* This contains logic for setting up shipping when the profiler completes.
|
||||
*/
|
||||
class OnboardingAutomateTaxes {
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action(
|
||||
'woocommerce_onboarding_profile_completed',
|
||||
array(
|
||||
__CLASS__,
|
||||
'on_onboarding_profile_completed',
|
||||
)
|
||||
);
|
||||
|
||||
add_action(
|
||||
'jetpack_authorize_ending_authorized',
|
||||
array(
|
||||
__CLASS__,
|
||||
'on_onboarding_profile_completed',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up automated taxes.
|
||||
*/
|
||||
public static function on_onboarding_profile_completed() {
|
||||
$jetpack_connected = null;
|
||||
$wcs_version = null;
|
||||
$wcs_tos_accepted = null;
|
||||
|
||||
if ( class_exists( '\Jetpack_Data' ) ) {
|
||||
$user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER );
|
||||
$jetpack_connected = isset( $user_token->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' ) );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue