Update: Leandro made a great suggestion, which is to declare the WooCommerce stylesheet as a dependency, which gets the job done in less lines of code. I’ve updated the gist to reflect this:
Update: Leandro made a great suggestion, which is to declare the WooCommerce stylesheet as a dependency, which gets the job done in less lines of code. I’ve updated the gist to reflect this:
this is cool, you just missed the parentheses after your function my_custom_scripts ()
cheers,
G
whoops, nice catch. Thanks
Cool this solved my headache, one quick question what if woo commerce decides to change the name
woocommerce_frontend_styles
To something else?
It is highly unlikely that they will, as it will cause backwards compatibility issues with every site using WooCommerce, but if they do, then we’ll just have to update accordingly.
could you please give a more specific example on this?
// register and enqueue your custom styles here
i didn’t understand what i have to do there… i want to customize for now only 2 woocommerce css file
woocommerce.css and woocommerce-layouts.css with 2 custom css file in my theme /yoo_vida_wp/style/sweet/css/woocommerce.css
and /yoo_vida_wp/style/sweet/css/woocommerce-layouts.css
In order to register and enqueue your custom styles, you will need to add a new line for each stylesheet you wish to use.
For example:
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
I would recommend reading the WordPress Codex, as it will explain what this function does in more detail: http://codex.wordpress.org/Function_Reference/wp_enqueue_style
Hello!
I’m using Woocommerce 2.1.11, and looks like they have changed woocommerce_frontend_styles to woocommerce-general.
Furthermore, just enqueuing your styles this way:
wp_enqueue_style(‘my-woocommerce-style’, get_template_directory_uri().’/my-woocommerce-style.css’, array(‘woocommerce-general’));
Is enough to cascade your styles properly, having my-woocommerce-style.css loading AFTER woocommerce.css
Cheers
Hi Leandro,
Yes, it appears that WooCommerce has changed the naming of their css styles – something I thought they would never do. It’s easy to update though.
I like your suggestion to enqueue custom styles and including the woocommerce-general css as a dependency works simple and fast.
You might mention, for child themes, you can use:
wp_enqueue_style(‘style-css’, get_stylesheet_directory_uri().’/style.css’, array(‘woocommerce-general’));
Thanks for this, a great solution!
Thanks for the suggestion Ron!