WooCommerce is the best eCommerce plugin for WordPress. All workflows are processed smoothly from backend to frontend. My team and I are able to adapt it to match the customized needs of my clients. Users generally find it easy to use.
But sometimes stores want to disable the purchase process (remove the cart and the buy button from the product page) — for a variety of scenarios:
- I was migrating a site from one server to another and wanted to make sure no orders were “trapped” on the old server once I edited the DNS records to point to the new server.
- For other kinds of test environments or site copies that might be seen in limited scenarios or edge cases.
- Some stores just want to display their products, as a display catalog and not for purchasing.
You can use this code to remove the buy button from the product page:
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
Place the code above in functions.php of your active theme.
Here’s a screenshot:
Before:
After:
This may not work with every theme and every setup. Learn more and see more complex code options at wordpress.stackexchange.com