From 8d0591d7c6725d6c762c3bb34c7f4d26b54275ba Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 1 Feb 2016 12:04:30 +0000 Subject: [PATCH] [2.5] Prevent notice in get_allowed_countries --- includes/class-wc-countries.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index 755abb9fc58..e2527ccba53 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -160,10 +160,12 @@ class WC_Countries { $countries = array(); - $raw_countries = get_option( 'woocommerce_specific_allowed_countries' ); + $raw_countries = get_option( 'woocommerce_specific_allowed_countries', array() ); - foreach ( $raw_countries as $country ) { - $countries[ $country ] = $this->countries[ $country ]; + if ( $raw_countries ) { + foreach ( $raw_countries as $country ) { + $countries[ $country ] = $this->countries[ $country ]; + } } return apply_filters( 'woocommerce_countries_allowed_countries', $countries );