This past week I started building a WordPress site with WooCommerce and for the life of me could not find what actions and hooks I needed to remove price, add to cart, and star rating from WooCommerce Archive Pages and the main Shop Page.
This should be something very simple to do and easy enough to find the right actions to remove with a quick search – but good ole Google wasn’t able to find anything.
So, if you are like me and struggling to find the right hooks + actions to remove features from the default Woocommerce Product Loop – Here is everything you need 🙂
You’ll want to either place this code in your child theme’s functions.php file, or paste it into the wonderful Code Snippets plugin.
remove_action ('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 ); remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart'); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
Doing this removes the star ratings, the price and the add to cart button in your product loop, so that all that will show is the image of the product and the title below.
My hope is if you should try to search any of these phrases with quotes, good ole Google will return you this post when you search “Remove Price and Cart From Woocommerce Archive Pages” in quotes.
Anyways, short + sweet, hopefully, it helps you in the case you can’t easily find the documentation on how to do this anywhere. 🙂
It may not be funny, but it sure is ridiculous how hard it is to find documentation on how to remove the cart and price on Woocommerce shop pages and product category archives – it’s just three simple actions!