skip to Main Content

Is there a CSS ID for the WooCommerce shop page like there is for single-product etc, so that I can easily target CSS for that page only?

2

Answers


  1. You can check for classes in body tag of your shop page. If your theme adds any specific class for shop then you’ll find it there else post-type-archive-product class may help.

    Login or Signup to reply.
  2. WooCommerce does not add a body class specifically for the main shop page.
    post-type-archive-product is probably enough for most cases.

    But if you want to specifically style the main shop page instead of all product archives then you can use a filter:

    add_filter('body_class', 'add_my_woocommerce_shop_body_class');
    function add_my_woocommerce_shop_body_class($classes)
    {
        if (is_shop()) {
            $classes[] = 'my-woocommerce-shop-class';
        }
        return $classes;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search