Skip Navigation

[Resuelto] Deregister wcviews-onsalebadge.js?

This support ticket is created hace 6 años, 10 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Etiquetado: ,

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Valeriia hace 6 años, 10 meses.

Asistido por: Beda.

Autor
Mensajes
#612286

Hi,

How do I deregister wcviews-onsalebadge.js?

Thanks

#612360

I cannot recommend this.

Every asset we load we load it at the time we need (or may need), and removing it, may cause issue that later are mistakenly reported as Bugs.

However, this specific script is used by WooCommerce Views, in the file Class_WooCommerce_Views.php:

wp_enqueue_style('woocommerce_views_onsale_badge', plugins_url('res/css/wcviews-onsalebadge.css',__FILE__),$woocommerce_css_loaded,$wc_views_version);

wp_enqueue_script('woocommerce_views_onsale_badge_js', plugins_url('res/js/wcviews-onsalebadge.js',__FILE__),array('jquery'),$wc_views_version);

You can try to dequeue it with wp_dequeue_style() or wp_dequeue_script()
https://developer.wordpress.org/reference/functions/wp_dequeue_script/
https://developer.wordpress.org/reference/functions/wp_dequeue_style/

We cannot support or take responsibility for this thou. I cannot suggest to dequeue it.

#612496

Hi Beda,

Thank you for the reply.

This script is called on all the pages while a WooCommerce View is used only on one. Besides, we do not use "sales" functionality, so I see no reasons for this script to be loaded.

I love Toolset but it always adds so much to the code of the page and increases the load on the server that sometimes I prefer to build things manually. It would be nice if you add an option to enable scripts only on the pages where they are really needed, or disable them where they are not needed. At least some of them.

Thanks.