Merge pull request #23069 from woocommerce/fix/23061
Variation stock status field handling (displaying/hiding when needed)
This commit is contained in:
commit
cbf6149cb9
|
@ -62,11 +62,16 @@ jQuery( function( $ ) {
|
||||||
*/
|
*/
|
||||||
variable_manage_stock: function() {
|
variable_manage_stock: function() {
|
||||||
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).hide();
|
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).hide();
|
||||||
$( this ).closest( '.woocommerce_variation' ).find( '.hide_if_variation_manage_stock' ).show();
|
$( this ).closest( '.woocommerce_variation' ).find( '.variable_stock_status' ).show();
|
||||||
|
|
||||||
if ( $( this ).is( ':checked' ) ) {
|
if ( $( this ).is( ':checked' ) ) {
|
||||||
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).show();
|
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).show();
|
||||||
$( this ).closest( '.woocommerce_variation' ).find( '.hide_if_variation_manage_stock' ).hide();
|
$( this ).closest( '.woocommerce_variation' ).find( '.variable_stock_status' ).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parent level.
|
||||||
|
if ( $( 'input#_manage_stock:checked' ).length ) {
|
||||||
|
$( this ).closest( '.woocommerce_variation' ).find( '.variable_stock_status' ).hide();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -240,6 +240,8 @@ jQuery( function( $ ) {
|
||||||
$( 'div.stock_fields' ).hide();
|
$( 'div.stock_fields' ).hide();
|
||||||
$( 'p.stock_status_field:not( .hide_if_' + product_type + ' )' ).show();
|
$( 'p.stock_status_field:not( .hide_if_' + product_type + ' )' ).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$( 'input.variable_manage_stock' ).change();
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
// Date picker fields.
|
// Date picker fields.
|
||||||
|
|
|
@ -235,7 +235,7 @@ defined( 'ABSPATH' ) || exit;
|
||||||
'options' => wc_get_product_stock_status_options(),
|
'options' => wc_get_product_stock_status_options(),
|
||||||
'desc_tip' => true,
|
'desc_tip' => true,
|
||||||
'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
|
'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ),
|
||||||
'wrapper_class' => 'form-row form-row-full hide_if_variation_manage_stock',
|
'wrapper_class' => 'form-row form-row-full variable_stock_status',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue