From a0ef53dd71f4fa234cf034822cd27ed7c90459ff Mon Sep 17 00:00:00 2001 From: Cale9 Date: Tue, 18 May 2021 19:11:59 +1200 Subject: [PATCH 1/3] Fix for deleted Reduce or Zero rate tax classes --- includes/class-wc-install.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index 93ab40b0278..f511a4bd5a8 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -620,8 +620,11 @@ class WC_Install { add_option( 'woocommerce_demo_store', 'no', '', 'no' ); // Define initial tax classes. - WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) ); - WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) ); + if (is_new_install()) { + //Moved behind only for new install + WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) ); + WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) ); + } } /** From 3ee412155bf46b725ef04c1073a26658218a3d26 Mon Sep 17 00:00:00 2001 From: geektzu Date: Fri, 21 May 2021 18:04:35 +1200 Subject: [PATCH 2/3] Fixed function signature and re-ran unit tests locally Also stick to the commenting standard --- includes/class-wc-install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index f511a4bd5a8..ef495b56d16 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -620,8 +620,8 @@ class WC_Install { add_option( 'woocommerce_demo_store', 'no', '', 'no' ); // Define initial tax classes. - if (is_new_install()) { - //Moved behind only for new install + if ( self::is_new_install() ) { + // Moved behind only for new install. WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) ); WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) ); } From 394b6665f8ad12b0f91ae2cfeda1527805537110 Mon Sep 17 00:00:00 2001 From: geektzu Date: Fri, 28 May 2021 10:26:31 +1200 Subject: [PATCH 3/3] Move the comments as per code review --- includes/class-wc-install.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index ef495b56d16..103d28ac2fb 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -619,9 +619,8 @@ class WC_Install { add_option( 'woocommerce_checkout_highlight_required_fields', 'yes', '', 'yes' ); add_option( 'woocommerce_demo_store', 'no', '', 'no' ); - // Define initial tax classes. if ( self::is_new_install() ) { - // Moved behind only for new install. + // Define initial tax classes. WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) ); WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) ); }