Add a CSS class to WooCommerce Shop Page
Using the filter body_class
with the is_shop
conditional you can target the main WooCommerce shop page by adding a CSS class.
add_filter( 'body_class', 'woo_shop_class' ); // Add WooCommerce Shop Page CSS Class function woo_shop_class( $classes ) { if ( is_shop() ) // Set conditional $classes[] = 'woo-shop'; // Add Class return $classes; }
The above code snippet is added to your WordPress theme’s functions.php – it will add the ‘woo-shop’ CSS class to the body tag