Added confirmation before saving an empty list of countries to sell to in general WC settings.

This commit is contained in:
Peter Fabian 2019-05-02 21:26:29 +02:00
parent e647e4143a
commit 98edbd2f78
2 changed files with 15 additions and 3 deletions

View File

@ -171,5 +171,16 @@
$( '.wc-item-reorder-nav').closest( 'table' ).trigger( 'updateMoveButtons' );
$( '.submit button' ).on( 'click', function() {
if ( $( 'select#woocommerce_allowed_countries' ).val() === 'specific'
&& ! $("[name='woocommerce_specific_allowed_countries[]']").val() ) {
if ( window.confirm( woocommerce_settings_params.i18n_no_specific_countries_selected ) ) {
return true;
};
return false;
}
} );
});
})( jQuery, woocommerce_settings_params, wp );

View File

@ -138,9 +138,10 @@ if ( ! class_exists( 'WC_Admin_Settings', false ) ) :
'woocommerce_settings',
'woocommerce_settings_params',
array(
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
'i18n_moved_up' => __( 'Item moved up', 'woocommerce' ),
'i18n_moved_down' => __( 'Item moved down', 'woocommerce' ),
'i18n_nav_warning' => __( 'The changes you made will be lost if you navigate away from this page.', 'woocommerce' ),
'i18n_moved_up' => __( 'Item moved up', 'woocommerce' ),
'i18n_moved_down' => __( 'Item moved down', 'woocommerce' ),
'i18n_no_specific_countries_selected' => __( 'Selecting no country to sell to prevents from completing the checkout. Continue anyway?', 'woocommerce' ),
)
);