Loop panels to disable options rather than look at values

This commit is contained in:
Mike Jolley 2019-02-27 14:38:11 +00:00
parent 0469bbe8b0
commit 5a48c41209
1 changed files with 6 additions and 6 deletions

View File

@ -470,13 +470,13 @@ jQuery( function( $ ) {
show_and_hide_panels();
// Make sure the dropdown is not disabled for empty value attributes.
var nr_elements = original_data.length / 6;
for ( var i = 0; i < nr_elements; i++ ) {
if ( typeof( original_data ) !== 'undefined' && original_data[ i * 6 + 2 ].value === '' ) {
$( 'select.attribute_taxonomy' )
.find( 'option[value="' + original_data[ i * 6 ].value + '"]' ).removeAttr( 'disabled' );
$( 'select.attribute_taxonomy' ).find( 'option' ).prop( 'disabled', false );
$( '.product_attributes .woocommerce_attribute' ).each( function( index, el ) {
if ( $( el ).css( 'display' ) !== 'none' && $( el ).is( '.taxonomy' ) ) {
$( 'select.attribute_taxonomy' ).find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' ).prop( 'disabled', true );
}
}
});
// Reload variations panel.
var this_page = window.location.toString();