Modify WooCommerce Stylesheets

Feb 15, 2023

This code snippet is using the add_filter function to add a new filter to the woocommerce_enqueue_styles hook in WordPress. This hook is used to enqueue stylesheets in the WooCommerce plugin.

add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
 unset( $enqueue_styles['( css file name)'] ); 
 return $enqueue_styles;

The function passed to add_filter (in this case: jk_dequeue_styles) is called a “callback” function, and it modifies the list of stylesheets that are enqueued by WooCommerce. The $enqueue_styles argument is an array of stylesheets that are being enqueued by WooCommerce, and the unset function is used to remove a specific stylesheet from this array.

In this case, the stylesheet being removed is specified by the (css file name) placeholder. You will need to replace this placeholder with the actual name of the stylesheet file that you want to remove.

Finally, the modified array of stylesheets is returned by the jk_dequeue_styles function, which will cause only the remaining stylesheets in the array to be enqueued by WooCommerce.

Ready to start?

Contact our CTO or fill out the form

    By entering your email, you agree with our Terms of use and Privacy policy