diff --git a/includes/admin/core/class-admin-builder.php b/includes/admin/core/class-admin-builder.php index eb3011b2..46272e9e 100644 --- a/includes/admin/core/class-admin-builder.php +++ b/includes/admin/core/class-admin-builder.php @@ -53,6 +53,11 @@ if ( ! class_exists( 'um\admin\core\Admin_Builder' ) ) { $validate = $field_attr['validate']; foreach ( $validate as $post_input => $arr ) { + // 'billing_country' and 'shipping_country' + if( $post_input === '_options' && isset( $array[ 'post' ][ '_metakey' ] ) && in_array( $array[ 'post' ][ '_metakey' ], array( 'billing_country', 'shipping_country' ) ) ) { + continue; + } + $mode = $arr['mode']; switch ( $mode ) { diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 514fb151..09def145 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2472,6 +2472,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { $output .= '
'; } + $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