Skip to content

Commit

Permalink
Hide empty panels
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jun 28, 2016
1 parent 53552f8 commit 0a8e219
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions assets/js/admin/meta-boxes-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a8e219

Please sign in to comment.