Add a CSS class to WooCommerce Shop Page

Do you want to add a specific CSS class to your woocommerce shop page?


Then let me show you this trick to add a class to woocommerce page. You not only add a class to the shop page, but you can also add a class to any other specific page by targeting the page ID.

Add a CSS class to WooCommerce Shop Page

To add a specific class to the <body> tag on woocommerce page, you can use the body_class filter hook. It will append your custom class within existing classes.

See the example here.

Save the above code in your theme’s functions.php file and now refresh the woocommerce shop page. You will see your custom class “custom-woo-shop” added to the body tag.

Being Tricky 😉

Leave a Reply

Your email address will not be published. Required fields are marked *