Remove Wordpress WooCommerce StoreFront Header Styles
11,038
Solution 1
For anyone that is fighting with this, this is the solution I found:
function my_theme_remove_storefront_standard_functionality() {
//remove customizer inline styles from parent theme as I don't need it.
set_theme_mod('storefront_styles', '');
set_theme_mod('storefront_woocommerce_styles', '');
}
add_action( 'init', 'my_theme_remove_storefront_standard_functionality' );
Solution 2
The two of inline CSS was added in class-storefront-customizer.php.
For deregister storefront-style-inline-css:
add_filter('storefront_customizer_css', '__return_false');
For deregister storefront-woocommerce-style-inline-css:
add_filter('storefront_customizer_woocommerce_css', '__return_false');
Solution 3
I had to remove these recently, and the best way to do it is using Ngoc Nguyen's method.
Just put the below code in your functions.php
function wpcustom_deregister_scripts_and_styles(){
wp_deregister_style('storefront-woocommerce-style');
wp_deregister_style('storefront-style');
}
add_action( 'wp_print_styles', 'wpcustom_deregister_scripts_and_styles', 100 );
Author by
Stuart
Updated on June 28, 2022Comments
-
Stuart almost 2 years
The Wordpress WooCommerce StoreFront Theme queues styles in the header from the WooCommerce StoreFront Customiser;
<style id='storefront-woocommerce-style-inline-css' type='text/css'></style> <style id='storefront-style-inline-css' type='text/css'></style>
I seem to spend more time over-righting these styles, than defining what I want. Does anyone know how to remove them or disable the Storefront customiser?
-
Stuart almost 8 yearsStill not working. I've spent hours trying to figure this one out.
-
Tim almost 8 yearsThank-you! I was fighting with this for too long
-
Brad Adams over 6 yearsHelpful but doesn't answer exactly what OP wanted. This removes the styles enqueued by Storefront, not the inline styles it adds within
<head>
. -
Maciej Paprocki over 6 yearsRemoving line in storefront theme will brake the theme on first storefront update
-
ecg8 about 6 years+1. This just helped me get rid of the woocommerce.css style that storefront was adding to my theme. Never would have figured it out on my own.