Added button to dismiss variation error notices

This commit is contained in:
Claudio Sanches 2015-07-29 19:56:33 -03:00
parent d0e34588aa
commit b28c6db7f5
3 changed files with 12 additions and 3 deletions

View File

@ -13,7 +13,8 @@ jQuery( function( $ ) {
$( '#variable_product_options' )
.on( 'change', 'input.variable_is_downloadable', this.variable_is_downloadable )
.on( 'change', 'input.variable_is_virtual', this.variable_is_virtual )
.on( 'change', 'input.variable_manage_stock', this.variable_manage_stock );
.on( 'change', 'input.variable_manage_stock', this.variable_manage_stock )
.on( 'click', 'button.notice-dismiss', this.notice_dismiss );
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock' ).change();
@ -55,6 +56,13 @@ jQuery( function( $ ) {
}
},
/**
* Notice dismiss
*/
notice_dismiss: function() {
$( this ).closest( 'div.notice' ).remove();
},
/**
* Run actions when variations is loaded
*/

File diff suppressed because one or more lines are too long

View File

@ -2582,12 +2582,13 @@ class WC_AJAX {
wc_delete_product_transients( $product_id );
if ( $errors = WC_Admin_Meta_Boxes::$meta_box_errors ) {
echo '<div id="woocommerce_errors" class="error">';
echo '<div class="error notice is-dismissible">';
foreach ( $errors as $error ) {
echo '<p>' . wp_kses_post( $error ) . '</p>';
}
echo '<button type="button" class="notice-dismiss"><span class="screen-reader-text">' . __( 'Dismiss this notice.', 'woocommerce' ) . '</span></button>';
echo '</div>';
delete_option( 'woocommerce_meta_box_errors' );