Fix for fields shipping_country and billing_country.

Issue: billing_country not working in Default Profile anymore.
Link: https://secure.helpscout.net/conversation/907381731/32251?folderId=1651531
This commit is contained in:
denisbaranov
2019-07-19 15:10:23 +03:00
parent d535b63eb1
commit 90bef79a4b
2 changed files with 18 additions and 1 deletions
+13 -1
View File
@@ -2472,6 +2472,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$output .= '<div class="um-field-icon"><i class="' . $icon . '"></i></div>';
}
$options = array();
$has_parent_option = false;
$disabled_by_parent_option = '';
$atts_ajax = '';
@@ -2604,10 +2605,21 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$options = UM()->builtin()->get ( $filter );
}
if ( ! isset( $options ) ) {
// 'country'
if( $key === 'country' && empty( $options ) ) {
$options = UM()->builtin()->get( 'countries' );
}
// 'billing_country' and 'shipping_country'
if( in_array( $key, array( 'billing_country', 'shipping_country' ) ) ) {
$countries = UM()->builtin()->get( 'countries' );
if( empty( $options ) || !is_array( $options ) ) {
$options = $countries;
} else {
$options = array_intersect_key( $countries, array_flip( $options ) );
}
}
if ( isset( $options ) ) {
/**
* UM hook