From c00cbe531479acc4a768b599a73f28ade4ed61bc Mon Sep 17 00:00:00 2001 From: Abdalsalaam Halawa Date: Mon, 18 Aug 2025 08:38:59 +0200 Subject: [PATCH 1/5] Don't load shipping settings if WC shipping or tax-only is enabled --- classes/class-wc-connect-help-view.php | 21 ++++++++++++--------- woocommerce-services.php | 11 ++++++++++- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/classes/class-wc-connect-help-view.php b/classes/class-wc-connect-help-view.php index 4561fd847..0a90b5cd3 100644 --- a/classes/class-wc-connect-help-view.php +++ b/classes/class-wc-connect-help-view.php @@ -297,15 +297,18 @@ public function page() { ) ); - do_action( - 'enqueue_wc_connect_script', - 'wc-connect-admin-test-print', - array( - 'isShippingLoaded' => $this->is_shipping_loaded(), - 'storeOptions' => $this->service_settings_store->get_store_options(), - 'paperSize' => $this->service_settings_store->get_preferred_paper_size(), - ) - ); + // Shipping related. + if ( ! WC_Connect_Loader::is_wc_shipping_activated() && '1' !== WC_Connect_Options::get_option( 'only_tax' ) ) { + do_action( + 'enqueue_wc_connect_script', + 'wc-connect-admin-test-print', + array( + 'isShippingLoaded' => $this->is_shipping_loaded(), + 'storeOptions' => $this->service_settings_store->get_store_options(), + 'paperSize' => $this->service_settings_store->get_preferred_paper_size(), + ) + ); + } } /** diff --git a/woocommerce-services.php b/woocommerce-services.php index 3ebc6b729..02f029b5f 100644 --- a/woocommerce-services.php +++ b/woocommerce-services.php @@ -914,6 +914,15 @@ public function load_admin_dependencies() { add_action( 'admin_notices', array( WC_Connect_Error_Notice::instance(), 'render_notice' ) ); add_action( 'admin_notices', array( $this, 'render_schema_notices' ) ); + /** + * Don't load shipping settings and notices when: + * 1. WC Shipping plugin is active (it handles its own settings). + * 2. Plugin is in tax-only mode (shipping features are disabled). + */ + if ( self::is_wc_shipping_activated() || '1' === WC_Connect_Options::get_option( 'only_tax' ) ) { + return; + } + // We only use the settings page for shipping since tax settings are part of // the core "WooCommerce > Settings > Tax" tab. require_once __DIR__ . '/classes/class-wc-connect-settings-pages.php'; @@ -921,7 +930,7 @@ public function load_admin_dependencies() { $this->set_settings_pages( $settings_pages ); // Add WC Admin Notices. - if ( ! self::is_wc_shipping_activated() && self::can_add_wc_admin_notice() ) { + if ( self::can_add_wc_admin_notice() ) { require_once __DIR__ . '/classes/class-wc-connect-note-dhl-live-rates-available.php'; WC_Connect_Note_DHL_Live_Rates_Available::init( $schema ); } From bed8534a006a7db715f8c85fd09609836fdd402a Mon Sep 17 00:00:00 2001 From: Abdalsalaam Halawa Date: Tue, 19 Aug 2025 03:21:48 +0200 Subject: [PATCH 2/5] add changelog --- changelog.txt | 3 +++ readme.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/changelog.txt b/changelog.txt index 83b439300..a578a981a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** WooCommerce Tax Changelog *** += 3.0.9 - 2025-xx-xx = +* Fix - Exclude shipping-related admin components when shipping functionality is disabled. + = 3.0.8 - 2025-08-13 = * Fix - Improves performance when WooCommerce Shipping is not active. * Fix - Restore shipping label functionality for merchants with shipping features enabled. diff --git a/readme.txt b/readme.txt index 61c770a12..0e5fa4530 100644 --- a/readme.txt +++ b/readme.txt @@ -70,6 +70,9 @@ This plugin relies on the following external services: == Changelog == += 3.0.9 - 2025-xx-xx = +* Fix - Exclude shipping-related admin components when shipping functionality is disabled. + = 3.0.8 - 2025-08-13 = * Fix - Improves performance when WooCommerce Shipping is not active. * Fix - Restore shipping label functionality for merchants with shipping features enabled. From ea1372e0262e572adb7f26460f2f6a068c26dca5 Mon Sep 17 00:00:00 2001 From: Abdalsalaam Halawa Date: Tue, 19 Aug 2025 03:33:47 +0200 Subject: [PATCH 3/5] revert change-keep live rates --- woocommerce-services.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/woocommerce-services.php b/woocommerce-services.php index 02f029b5f..3ebc6b729 100644 --- a/woocommerce-services.php +++ b/woocommerce-services.php @@ -914,15 +914,6 @@ public function load_admin_dependencies() { add_action( 'admin_notices', array( WC_Connect_Error_Notice::instance(), 'render_notice' ) ); add_action( 'admin_notices', array( $this, 'render_schema_notices' ) ); - /** - * Don't load shipping settings and notices when: - * 1. WC Shipping plugin is active (it handles its own settings). - * 2. Plugin is in tax-only mode (shipping features are disabled). - */ - if ( self::is_wc_shipping_activated() || '1' === WC_Connect_Options::get_option( 'only_tax' ) ) { - return; - } - // We only use the settings page for shipping since tax settings are part of // the core "WooCommerce > Settings > Tax" tab. require_once __DIR__ . '/classes/class-wc-connect-settings-pages.php'; @@ -930,7 +921,7 @@ public function load_admin_dependencies() { $this->set_settings_pages( $settings_pages ); // Add WC Admin Notices. - if ( self::can_add_wc_admin_notice() ) { + if ( ! self::is_wc_shipping_activated() && self::can_add_wc_admin_notice() ) { require_once __DIR__ . '/classes/class-wc-connect-note-dhl-live-rates-available.php'; WC_Connect_Note_DHL_Live_Rates_Available::init( $schema ); } From f80ce13dfe57ed03ee48d97abccbf9b643dfbb6f Mon Sep 17 00:00:00 2001 From: Abdalsalaam Halawa Date: Thu, 21 Aug 2025 16:11:04 +0200 Subject: [PATCH 4/5] Don't register settings if only_tax mode (new installations) --- woocommerce-services.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/woocommerce-services.php b/woocommerce-services.php index 965d86e7a..b611b6c51 100644 --- a/woocommerce-services.php +++ b/woocommerce-services.php @@ -914,6 +914,11 @@ public function load_admin_dependencies() { add_action( 'admin_notices', array( WC_Connect_Error_Notice::instance(), 'render_notice' ) ); add_action( 'admin_notices', array( $this, 'render_schema_notices' ) ); + // Don't register settings if only_tax mode. + if ( '1' === WC_Connect_Options::get_option( 'only_tax' ) ) { + return; + } + // We only use the settings page for shipping since tax settings are part of // the core "WooCommerce > Settings > Tax" tab. require_once __DIR__ . '/classes/class-wc-connect-settings-pages.php'; From c4c699458afd416992128d3bf391af960f70910a Mon Sep 17 00:00:00 2001 From: Abdalsalaam Halawa Date: Fri, 19 Sep 2025 07:27:38 +0200 Subject: [PATCH 5/5] fix changelog --- changelog.txt | 4 +++- readme.txt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index b64f666b8..c0b43dd3f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ *** WooCommerce Tax Changelog *** += 3.1.1 - 2025-xx-xx = +* Fix - Exclude shipping-related admin components when shipping functionality is disabled. + = 3.1.0 - 2025-09-16 = * Add - Increase cache time for address validation errors. * Tweak - WooCommerce 10.2 Compatibility. @@ -12,7 +15,6 @@ = 3.0.9 - 2025-08-26 = * Add - Migration survey to understand WooCommerce Shipping adoption blockers. -* Fix - Exclude shipping-related admin components when shipping functionality is disabled. = 3.0.8 - 2025-08-13 = * Fix - Improves performance when WooCommerce Shipping is not active. diff --git a/readme.txt b/readme.txt index a8d58a8c7..ff52d8d43 100644 --- a/readme.txt +++ b/readme.txt @@ -70,6 +70,9 @@ This plugin relies on the following external services: == Changelog == += 3.1.1 - 2025-xx-xx = +* Fix - Exclude shipping-related admin components when shipping functionality is disabled. + = 3.1.0 - 2025-09-16 = * Add - Increase cache time for address validation errors. * Tweak - WooCommerce 10.2 Compatibility. @@ -82,7 +85,6 @@ This plugin relies on the following external services: = 3.0.9 - 2025-08-26 = * Add - Migration survey to understand WooCommerce Shipping adoption blockers. -* Fix - Exclude shipping-related admin components when shipping functionality is disabled. = 3.0.8 - 2025-08-13 = * Fix - Improves performance when WooCommerce Shipping is not active.