I'm struggling to get a CSS file to load just on WooCommerce shop archive pages only.
Looking at the documentation I know there is a is_shop()
tag.
So I would have thought
function kodr_scripts_styles() {
if( is_shop() ) {
wp_enqueue_style( 'wc-shop', get_template_directory_uri() . '/css/shop-only.css', 'all' );
}
}
add_action( 'wp_enqueue_scripts', 'kodr_scripts_styles' );
Would work fine. But the file doesn't load. I know I can use is_woocommerce()
but I don't want this file loading on all WC pages. Any ideas?
Try out this code in your theme function.php:-
EDITED:-