Merge pull request #18160 from WPprodigy/hide-stock-status-on-variations

[3.3] Hide variation stock status setting conditionally
This commit is contained in:
Claudiu Lodromanean 2017-12-14 09:05:01 -08:00 committed by GitHub
commit 9cfc587d2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -62,9 +62,11 @@ jQuery( function( $ ) {
*/
variable_manage_stock: function() {
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).hide();
$( this ).closest( '.woocommerce_variation' ).find( '.hide_if_variation_manage_stock' ).show();
if ( $( this ).is( ':checked' ) ) {
$( this ).closest( '.woocommerce_variation' ).find( '.show_if_variation_manage_stock' ).show();
$( this ).closest( '.woocommerce_variation' ).find( '.hide_if_variation_manage_stock' ).hide();
}
},

View File

@ -88,7 +88,7 @@ jQuery( function( $ ) {
return false;
});
// PRODUCT TYPE SPECIFIC OPTIONS.
// Product type specific options.
$( 'select#product-type' ).change( function() {
// Get value.
@ -228,7 +228,7 @@ jQuery( function( $ ) {
return false;
});
// STOCK OPTIONS.
// Stock options.
$( 'input#_manage_stock' ).change( function() {
if ( $( this ).is( ':checked' ) ) {
$( 'div.stock_fields' ).show();
@ -241,7 +241,7 @@ jQuery( function( $ ) {
}
}).change();
// DATE PICKER FIELDS.
// Date picker fields.
function date_picker_select( datepicker ) {
var option = $( datepicker ).next().is( '.hasDatepicker' ) ? 'minDate' : 'maxDate',
otherDateField = 'minDate' === option ? $( datepicker ).next() : $( datepicker ).prev(),
@ -264,7 +264,7 @@ jQuery( function( $ ) {
$( this ).find( 'input' ).each( function() { date_picker_select( $( this ) ); } );
});
// ATTRIBUTE TABLES.
// Attribute Tables.
// Initial order.
var woocommerce_attribute_items = $( '.product_attributes' ).find( '.woocommerce_attribute' ).get();

View File

@ -109,7 +109,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'wrapper_class' => 'form-row form-row-first',
'placeholder' => __( 'Variation price (required)', 'woocommerce' ),
) );
$label = sprintf(
/* translators: %s: currency symbol */
__( 'Sale price (%s)', 'woocommerce' ),
@ -207,7 +207,7 @@ if ( ! defined( 'ABSPATH' ) ) {
'options' => wc_get_product_stock_status_options(),
'desc_tip' => true,
'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',
'wrapper_class' => 'form-row form-row-full hide_if_variation_manage_stock',
) );
if ( wc_product_weight_enabled() ) {