From 4a0342ac4bc5cc5877e3089089bda71f110bd417 Mon Sep 17 00:00:00 2001 From: Steffan Date: Thu, 14 Mar 2024 12:18:18 +0100 Subject: [PATCH] Fix warning after plugin install using wp-cli Fixes PHP Warning after plugin install using wp-cli : Undefined array key "ga_id" in /wp-content/plugins/woocommerce-google-analytics-integration/includes/class-wc-google-analytics.php on line 269 --- includes/class-wc-google-analytics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-google-analytics.php b/includes/class-wc-google-analytics.php index 7d34ef45..7bd02f58 100644 --- a/includes/class-wc-google-analytics.php +++ b/includes/class-wc-google-analytics.php @@ -266,7 +266,7 @@ public function privacy_policy() { * @return bool True if tracking for a certain setting is disabled */ private function disable_tracking( $type ) { - return is_admin() || current_user_can( 'manage_options' ) || ( ! $this->settings['ga_id'] ) || 'no' === $type || apply_filters( 'woocommerce_ga_disable_tracking', false, $type ); + return is_admin() || current_user_can( 'manage_options' ) || empty( $this->settings['ga_id'] ) || 'no' === $type || apply_filters( 'woocommerce_ga_disable_tracking', false, $type ); } /**