Hide empty panels

This commit is contained in:
Mike Jolley 2016-06-28 11:56:45 +01:00
parent 53552f8028
commit 0a8e219c9d
1 changed files with 17 additions and 0 deletions

View File

@ -162,6 +162,23 @@ jQuery( function( $ ) {
$( '.hide_if_' + product_type ).hide();
$( 'input#_manage_stock' ).change();
// Hide empty panels/tabs after display
$( '.woocommerce_options_panel' ).each( function() {
var $children = $( this ).children( '.options_group' );
if ( 0 === $children.length ) {
return;
}
var $invisble = $children.filter( function() { return 'none' === $( this ).css( 'display' ); } );
// Hide panel
if ( $invisble.length === $children.length ) {
var $id = $( this ).prop( 'id' );
$( '.product_data_tabs' ).find( 'li a[href="#' + $id + '"]' ).parent().hide();
}
} );
}
// Sale price schedule