Fix a bug in tax automation logic and track the event in analytics (https://github.com/woocommerce/woocommerce-admin/pull/5276)
This commit is contained in:
parent
1c009dd9e7
commit
259489a0b9
|
@ -56,9 +56,10 @@ class OnboardingAutomateTaxes {
|
|||
$wcs_tos_accepted = \WC_Connect_Options::get_option( 'tos_accepted' );
|
||||
}
|
||||
|
||||
if ( $jetpack_connected && $wcs_version && $wcs_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();
|
||||
Confirm_Tax_Settings::possibly_add_note();
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +68,13 @@ class OnboardingAutomateTaxes {
|
|||
* 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 );
|
||||
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