Merge pull request #2114 from krbvroc1/optional_sort
Add 'woocommerce_sort_countries' filter
This commit is contained in:
commit
43b0c2345b
|
@ -358,6 +358,7 @@ class WC_Countries {
|
|||
*/
|
||||
public function get_allowed_countries() {
|
||||
|
||||
if ( apply_filters('woocommerce_sort_countries', true ) )
|
||||
asort( $this->countries );
|
||||
|
||||
if ( get_option('woocommerce_allowed_countries') !== 'specific' )
|
||||
|
@ -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) ) :
|
||||
|
|
Loading…
Reference in New Issue