Disabling sortable functionality for product attributes at Dashboard

I tried this PHP snippet and added into the functions.php file of my active theme.

add_action( 'admin_footer', function(){
$screen = get_current_screen();
$screen_id = $screen ? $screen->id : '';
if ( ! in_array( $screen_id, array( 'product', 'edit-product' ) ) )
return;
?>
<script type="text/javascript">
jQuery( function( $ ) {
$( function() {
// Disabled attribute ordering.
$( '.product_attributes' ).sortable({
items: '.woocommerce_attribute',
disabled: true
});
$( '.woocommerce_attribute h3 .sort' ).css('display', 'none');
});
});
</script>
<?php
}, 999);
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.