Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to dequeue or deregister specific woocoomerce script in wordpress admin panel

I need to remove Woocommerce script: wc-admin-order-meta-boxes-js (woocommerce/assets/js/admin/meta-boxes-order.min.js) from the edit-order page or all admin pages in woocommerce. I tried everything but nothing works. Can anyone help me? Thanks.
For example, I tried this:

    add_action( 'admin_print_script', 'remove_admin_scripts', 1 );
     function remove_admin_scripts() {
    // Dequeue
    wp_dequeue_script( 'wc-admin-order-meta-boxes-js' );

    // Deregister
    wp_deregister_script( 'wc-admin-order-meta-boxes-js' );
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You are calling the wrong name of the script. You can just dequeue as it is enqueued, but with a higher priority.

add_action( 'admin_enqueue_scripts', 'remove_admin_scripts', 99 );
function remove_admin_scripts() {
    // Dequeue.
    wp_dequeue_script( 'wc-admin-order-meta-boxes' );
    // Deregister.
    wp_deregister_script( 'wc-admin-order-meta-boxes' );
}

This is tested and works.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading