Merge pull request #32589 from woocommerce/issue-31347
Enable "Save changes" for variations on the admin when a textfield receives input
This commit is contained in:
commit
84392cfbf6
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Enable the "Save changes" button within the variations panel when a textfield receives input.
|
|
@ -350,7 +350,7 @@ jQuery( function( $ ) {
|
|||
.on( 'click','.downloadable_files a.delete', this.input_changed );
|
||||
|
||||
$( document.body )
|
||||
.on( 'change', '#variable_product_options .woocommerce_variations :input', this.input_changed )
|
||||
.on( 'change input', '#variable_product_options .woocommerce_variations :input', this.input_changed )
|
||||
.on( 'change', '.variations-defaults select', this.defaults_changed );
|
||||
|
||||
var postForm = $( 'form#post' );
|
||||
|
@ -705,13 +705,18 @@ jQuery( function( $ ) {
|
|||
/**
|
||||
* Add new class when have changes in some input
|
||||
*/
|
||||
input_changed: function() {
|
||||
input_changed: function( event ) {
|
||||
$( this )
|
||||
.closest( '.woocommerce_variation' )
|
||||
.addClass( 'variation-needs-update' );
|
||||
|
||||
$( 'button.cancel-variation-changes, button.save-variation-changes' ).prop( 'disabled', false );
|
||||
|
||||
// Do not trigger 'woocommerce_variations_input_changed' for 'input' events for backwards compat.
|
||||
if ( 'input' === event.type && $( this ).is( ':text' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$( '#variable_product_options' ).trigger( 'woocommerce_variations_input_changed' );
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue