×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

Hide SKUs in frontend only, or completely

The first example in this code snippet can be used to remove all references to SKUs entirely from the site, frontend and backend. The second example just hides them on the frontend.

		/**
 * Disable SKUs completely
 */

add_filter('wc_product_sku_enabled', '__return_false');


/**
 * Hide SKUs in the frontend but keep them in the backend
 */

add_filter('wc_product_sku_enabled', 'sc_woo_hide_frontend_skus');

function sc_woo_hide_frontend_skus($enabled){

  if(!is_admin() && is_product()){
    return false;
  }

  return $enabled;

}
	
   View Raw Code ID: 91034