Website Building » WooCommerce » How Do I Hide SKU WooCommerce?

How Do I Hide SKU WooCommerce?

Last updated on January 20, 2023 @ 12:07 pm

It is no secret that many online retailers use SKU numbers to keep track of their inventory. However, there are a few reasons why you might want to hide the SKU number on your WooCommerce site.

Perhaps you think it looks unprofessional, or maybe you simply want to declutter your product pages. Whatever the reason, hiding the SKU number on WooCommerce is relatively easy to do.

The first thing you need to do is install and activate the WooCommerce Hide SKU plugin. For more information, see our step by step guide on how to install a WordPress plugin.

Once the plugin is activated, go to WooCommerce > Settings from your WordPress admin panel. On the General tab, scroll down to the Inventory section and check the box next to “Hide SKU for out of stock products”.

Now any products that are out of stock will have their SKU number hidden on the front-end of your website.

Hiding SKU Numbers for All Products

If you want to hide the SKU number for all products, regardless of whether they are in stock or not, then there is a little bit of code you can add to your functions.php file.

PRO TIP: If you are considering hiding your SKU in WooCommerce, be aware that this may have negative consequences for your store. Hiding your SKU can make it difficult for customers to find the product they are looking for, and may also make it more difficult for you to track inventory levels.

You should always back up your site before making any changes to your code.

First, you need to connect to your website using an FTP client like Filezilla and go to the /wp-content/themes/your-theme-folder/ directory. Within your theme folder, locate and open the functions.php file in a text editor like Notepad++.

Your theme folder will be named after the theme you are using. For example, if you are using the Twenty Seventeen theme, then your theme folder will be called twentyseventeen.

At the bottom of your functions.php file, add this code:

function wc_hide_sku_ everywhere() {
  global $product;
  return $product->get_sku();
}
add_filter( 'wc_product_sku_enabled', 'wc_hide_sku_everywhere' );

Save your changes and upload the modified functions.php file back to your server.

Conclusion: How Do I Hide SKU WooCommerce?

By following the steps above, you can easily hide the SKU number on WooCommerce products that are out of stock. If you want to hide the SKU number for all products, then you can add a little bit of code to your functions.

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.