Catalog Mode (Prices Without Purchasing)
Turns the shop into a catalog: products and prices stay visible, but add to cart buttons, the cart and checkout are disabled for everyone.
Opens WPIDE on
Code
add_filter( 'woocommerce_is_purchasable', '__return_false', 99 );
add_filter( 'woocommerce_variation_is_purchasable', '__return_false', 99 );
add_action( 'template_redirect', function () {
if ( function_exists( 'is_cart' ) && ( is_cart() || is_checkout() ) ) {
wp_safe_redirect( wc_get_page_permalink( 'shop' ) );
exit;
}
} );
add_action( 'woocommerce_single_product_summary', function () {
echo '<p class="wpide-catalog-note">' . esc_html( 'Contact us to order this product.' ) . '</p>';
}, 31 );
Notes
Visitors who open the cart or checkout URL are sent back to the shop. Deactivate the snippet to start selling again.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.