Update quick edit logic to show/hide Stock qty and Backorders fields

This commit is contained in:
Edi Amin 2018-09-08 21:39:09 +06:00
parent 0cc137be1e
commit 39b7450cd6
1 changed files with 4 additions and 4 deletions

View File

@ -70,11 +70,11 @@ jQuery(function( $ ) {
if ( product_supports_stock_fields ) {
if ( 'yes' === manage_stock ) {
$( '.stock_fields' ).show().removeAttr( 'style' );
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).show().removeAttr( 'style' );
$( '.stock_status_field' ).hide();
$( '.manage_stock_field input' ).prop( 'checked', true );
} else {
$( '.stock_qty_field', '.inline-edit-row' ).hide();
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).hide();
$( '.stock_status_field' ).show().removeAttr( 'style' );
$( '.manage_stock_field input' ).prop( 'checked', false );
}
@ -103,10 +103,10 @@ jQuery(function( $ ) {
$( '#the-list' ).on( 'change', '.inline-edit-row input[name="_manage_stock"]', function() {
if ( $( this ).is( ':checked' ) ) {
$( '.stock_qty_field', '.inline-edit-row' ).show().removeAttr( 'style' );
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).show().removeAttr( 'style' );
$( '.stock_status_field' ).hide();
} else {
$( '.stock_qty_field', '.inline-edit-row' ).hide();
$( '.stock_qty_field, .backorder_field', '.inline-edit-row' ).hide();
$( '.stock_status_field' ).show().removeAttr( 'style' );
}