A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Make Classic Commerce a catalogue site, hide selling functions

Many Classic Commerce installations are only used to show a product range, with no need for cart, checkout, shipping or payments. These sites are intended to be a catalogue, rather than a shop. The snippets below remove the add-to-cart buttons and simplify the back end to hide unused menu items and tabs. The text on the “Add to cart” button on the category pages becomes “Read more”.

You could also use the Remove the Classic Commerce dashboard widget snippet to hide the sales widget in the dashboard.

The code example only leaves Settings and Status as admin menu items, and General and Products as settings tabs. You can edit the snippet to show or hide others.

		/**
 * Make Classic Commerce a catalogue site and remove selling functions
 */

// Removes purchasing functionality from product and category views. Hides unnecessary tabs and menu items in back end.
// https://plugintests.com/plugins/wporg/woocommerce/tips
// https://react2wp.com/remove-hide-add-to-cart-button-in-woocommerce-while-disabling-keeping-purchase-functionality/

add_filter( 'woocommerce_is_purchasable', '__return_false'); // Disable purchase functionality and remove adding to cart button from normal products

remove_action('woocommerce_single_variation', 'woocommerce_single_variation', 10); // Remove price from variations

remove_action('woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20); // Remove add to cart button from variations

add_action('admin_menu', 'cc_hide_commerce_menus', 71);

function cc_hide_commerce_menus() {

  //Hide "Commerce → Orders".
  remove_submenu_page('woocommerce', 'edit.php?post_type=shop_order');
  //Hide "Commerce → Customers".
  remove_submenu_page('woocommerce', 'wc-admin&path=/customers');
  //Hide "Commerce → Reports".
  remove_submenu_page('woocommerce', 'wc-reports');
  //Hide "Commerce → Settings".
  //remove_submenu_page('woocommerce', 'wc-settings');
  //Hide "Commerce → Status".
  //remove_submenu_page('woocommerce', 'wc-status');
  //Hide "Commerce → Extensions".
  remove_submenu_page('woocommerce', 'wc-addons');

}

add_filter('woocommerce_settings_tabs_array', 'cc_remove_setting_tabs', 200, 1);

function cc_remove_setting_tabs($tabs) {

  // Declare the tabs we want to hide
  $tabs_to_hide = array(
    'Shipping',
    'Payments',
    'Emails',
    'Advanced',
    'Accounts & Privacy',
  );
  $tabs = array_diff($tabs, $tabs_to_hide);

  return $tabs;

}
	
View Raw Code ID: 92721