From 23fe784e5a132c3e8b351730b377df7d785bd6a9 Mon Sep 17 00:00:00 2001 From: Tom Castle Date: Wed, 8 Dec 2021 12:53:20 +0000 Subject: [PATCH] Fix #31393 to use country from headers only if geolocating current user --- plugins/woocommerce/includes/class-wc-geolocation.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce/includes/class-wc-geolocation.php b/plugins/woocommerce/includes/class-wc-geolocation.php index 09c76e9b435..d47ac659386 100644 --- a/plugins/woocommerce/includes/class-wc-geolocation.php +++ b/plugins/woocommerce/includes/class-wc-geolocation.php @@ -149,11 +149,10 @@ class WC_Geolocation { } if ( empty( $ip_address ) ) { - $ip_address = self::get_ip_address(); + $ip_address = self::get_ip_address(); + $country_code = self::get_country_code_from_headers(); } - $country_code = self::get_country_code_from_headers(); - /** * Get geolocation filter. *