diff --git a/assets/js/admin/wc-setup.js b/assets/js/admin/wc-setup.js index 443250cd796..64c78616bc9 100644 --- a/assets/js/admin/wc-setup.js +++ b/assets/js/admin/wc-setup.js @@ -1,4 +1,5 @@ /*global wc_setup_params */ +/*global wc_setup_currencies */ jQuery( function( $ ) { function blockWizardUI() { $('.wc-setup-content').block({ @@ -136,4 +137,9 @@ jQuery( function( $ ) { } ); $( '.wc-wizard-services input#stripe_create_account' ).change(); + + $( 'select#store_country_state' ).on( 'change', function() { + var countryCode = this.value.split( ':' )[ 0 ]; + $( 'select#currency_code' ).val( wc_setup_currencies[ countryCode ] ).change(); + } ); } ); diff --git a/includes/admin/class-wc-admin-setup-wizard.php b/includes/admin/class-wc-admin-setup-wizard.php index 2be34ccd6dc..10c49a1e597 100644 --- a/includes/admin/class-wc-admin-setup-wizard.php +++ b/includes/admin/class-wc-admin-setup-wizard.php @@ -304,6 +304,9 @@ class WC_Admin_Setup_Wizard { $state = '*'; } + $locale_info = include( WC()->plugin_path() . '/i18n/locale-info.php' ); + $currency_by_country = wp_list_pluck( $locale_info, 'currency_code' ); + ?>