From 835c38fa5b3848e946ce2a0f597580eb019d6580 Mon Sep 17 00:00:00 2001 From: Ken Bass Date: Wed, 2 Jan 2013 12:05:54 -0500 Subject: [PATCH] Add 'woocommerce_sort_countries' filter --- classes/class-wc-countries.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/classes/class-wc-countries.php b/classes/class-wc-countries.php index 6c84bde8338..a1e8f96f9af 100644 --- a/classes/class-wc-countries.php +++ b/classes/class-wc-countries.php @@ -357,8 +357,9 @@ class WC_Countries { * @return array */ public function get_allowed_countries() { - - asort( $this->countries ); + + if ( apply_filters('woocommerce_sort_countries', true ) ) + asort( $this->countries ); if ( get_option('woocommerce_allowed_countries') !== 'specific' ) return $this->countries; @@ -498,7 +499,8 @@ class WC_Countries { */ public function country_dropdown_options( $selected_country = '', $selected_state = '', $escape = false ) { - asort($this->countries); + if ( apply_filters('woocommerce_sort_countries', true ) ) + asort( $this->countries ); if ( $this->countries ) foreach ( $this->countries as $key=>$value) : if ( $states = $this->get_states($key) ) :