#51035 closed defect (bug) (invalid)
drop downs are not working
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.5 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description (last modified by )
I am using WP 5.5
After update, first I noticed plugin "WooCommerce Shipment Tracking" used on Edit Order page was not working anymore. The button for "Add Tracking Number" didn't do anything.
After a LOT of digging, I found that plugin uses this CSS:
#woocommerce-shipment-tracking #shipment-tracking-form{display:none}
And then a Javascript function in admin.js is supposed to change the display to show it:
jQuery( function( $ ) {
var wc_shipment_tracking_items = {
// init Class
init: function() {
$( '#woocommerce-shipment-tracking' )
.on( 'click', 'a.delete-tracking', this.delete_tracking )
.on( 'click', 'button.button-show-form', this.show_form )
.on( 'click', 'button.button-save-form', this.save_form );
},
// When a user enters a new tracking item
save_form: function () {
if ( !$( 'input#tracking_number' ).val() ) {
return false;
}
$( '#shipment-tracking-form' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
var data = {
action: 'wc_shipment_tracking_save_form',
order_id: woocommerce_admin_meta_boxes.post_id,
tracking_provider: $( '#tracking_provider' ).val(),
custom_tracking_provider: $( '#custom_tracking_provider' ).val(),
custom_tracking_link: $( 'input#custom_tracking_link' ).val(),
tracking_number: $( 'input#tracking_number' ).val(),
date_shipped: $( 'input#date_shipped' ).val(),
security: $( '#wc_shipment_tracking_create_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#shipment-tracking-form' ).unblock();
if ( response != '-1' ) {
$( '#shipment-tracking-form' ).hide();
$( '#woocommerce-shipment-tracking #tracking-items' ).append( response );
$( '#woocommerce-shipment-tracking button.button-show-form' ).show();
$( '#tracking_provider' ).selectedIndex = 0;
$( '#custom_tracking_provider' ).val( '' );
$( 'input#custom_tracking_link' ).val( '' );
$( 'input#tracking_number' ).val( '' );
$( 'input#date_shipped' ).val( '' );
$('p.preview_tracking_link').hide();
}
});
return false;
},
// Show the new tracking item form
show_form: function () {
$( '#shipment-tracking-form' ).show();
$( '#woocommerce-shipment-tracking button.button-show-form' ).hide();
},
// Delete a tracking item
delete_tracking: function() {
var tracking_id = $( this ).attr( 'rel' );
$( '#tracking-item-' + tracking_id ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action: 'wc_shipment_tracking_delete_item',
order_id: woocommerce_admin_meta_boxes.post_id,
tracking_id: tracking_id,
security: $( '#wc_shipment_tracking_delete_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#tracking-item-' + tracking_id ).unblock();
if ( response != '-1' ) {
$( '#tracking-item-' + tracking_id ).remove();
}
});
return false;
},
refresh_items: function() {
var data = {
action: 'wc_shipment_tracking_get_items',
order_id: woocommerce_admin_meta_boxes.post_id,
security: $( '#wc_shipment_tracking_get_nonce' ).val()
};
$( '#woocommerce-shipment-tracking' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#woocommerce-shipment-tracking' ).unblock();
if ( response != '-1' ) {
$( '#woocommerce-shipment-tracking #tracking-items' ).html( response );
}
});
},
}
wc_shipment_tracking_items.init();
window.wc_shipment_tracking_refresh = wc_shipment_tracking_items.refresh_items;
} );
BUT, this no longer worked after updating to WP 5.5! I had to change the Javascript code to move the "jQuery" (namespace?) to a different location in the script:
( function( $ ) {
var wc_shipment_tracking_items = {
// init Class
init: function() {
$( '#woocommerce-shipment-tracking' )
.on( 'click', 'a.delete-tracking', this.delete_tracking )
.on( 'click', 'button.button-show-form', this.show_form )
.on( 'click', 'button.button-save-form', this.save_form );
},
// When a user enters a new tracking item
save_form: function () {
if ( !$( 'input#tracking_number' ).val() ) {
return false;
}
$( '#shipment-tracking-form' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
var data = {
action: 'wc_shipment_tracking_save_form',
order_id: woocommerce_admin_meta_boxes.post_id,
tracking_provider: $( '#tracking_provider' ).val(),
custom_tracking_provider: $( '#custom_tracking_provider' ).val(),
custom_tracking_link: $( 'input#custom_tracking_link' ).val(),
tracking_number: $( 'input#tracking_number' ).val(),
date_shipped: $( 'input#date_shipped' ).val(),
security: $( '#wc_shipment_tracking_create_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#shipment-tracking-form' ).unblock();
if ( response != '-1' ) {
$( '#shipment-tracking-form' ).hide();
$( '#woocommerce-shipment-tracking #tracking-items' ).append( response );
$( '#woocommerce-shipment-tracking button.button-show-form' ).show();
$( '#tracking_provider' ).selectedIndex = 0;
$( '#custom_tracking_provider' ).val( '' );
$( 'input#custom_tracking_link' ).val( '' );
$( 'input#tracking_number' ).val( '' );
$( 'input#date_shipped' ).val( '' );
$('p.preview_tracking_link').hide();
}
});
return false;
},
// Show the new tracking item form
show_form: function () {
$( '#shipment-tracking-form' ).show();
$( '#woocommerce-shipment-tracking button.button-show-form' ).hide();
},
// Delete a tracking item
delete_tracking: function() {
var tracking_id = $( this ).attr( 'rel' );
$( '#tracking-item-' + tracking_id ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action: 'wc_shipment_tracking_delete_item',
order_id: woocommerce_admin_meta_boxes.post_id,
tracking_id: tracking_id,
security: $( '#wc_shipment_tracking_delete_nonce' ).val()
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#tracking-item-' + tracking_id ).unblock();
if ( response != '-1' ) {
$( '#tracking-item-' + tracking_id ).remove();
}
});
return false;
},
refresh_items: function() {
var data = {
action: 'wc_shipment_tracking_get_items',
order_id: woocommerce_admin_meta_boxes.post_id,
security: $( '#wc_shipment_tracking_get_nonce' ).val()
};
$( '#woocommerce-shipment-tracking' ).block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
} );
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function( response ) {
$( '#woocommerce-shipment-tracking' ).unblock();
if ( response != '-1' ) {
$( '#woocommerce-shipment-tracking #tracking-items' ).html( response );
}
});
},
}
wc_shipment_tracking_items.init();
window.wc_shipment_tracking_refresh = wc_shipment_tracking_items.refresh_items;
} )(jQuery); //FIXED DAK 8/14/20
Now that plugin works like before on the Edit Order page.
Okay, *now* I see OTHER places where I can't see items also. Like the pull down boxes in my theme's Menu editor.
https://www.dropbox.com/s/4of47izpnltdvci/ice_screenshot_20200816-110948.jpeg?dl=0
I guess I will have to roll back my WP to a previous version until this is fixed.
Sorry if my report is poorly written..:-)
Regards,
Dave K.
Hallo!
Please let the WooCommerce team know about this.
You can do so here: https://wordpress.org/support/plugin/woocommerce/
Core Trac is for reporting bugs in Core itself and the developers here will not be able to help you.
You can also post here https://wordpress.org/support/forum/how-to-and-troubleshooting/ for help on how to fix jQuery issues temporarily while the developers update their plugins.
I am closing this ticket here for the Core Team's workflows.
Good luck with your site!