WooCommerce: Hide SKU @ Single Product Page

This is a very common task. As a WooCommerce store manager, sometimes you need to hide the SKU field on the single product page, while keeping it in the backend (Product Edit page) for order tracking and product import/export purposes.

Here’s a simple snippet you can use to remove the SKU immediately ๐Ÿ™‚

WooCommerce: hide SKU on the front-end

PHP Snippet: Hide “SKU” @ WooCommerce Single Product Page

/**
 * @snippet       Hide SKU @ Single Product Page - WooCommerce
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WC 3.8
 * @community     https://businessbloomer.com/club/
 */
 
add_filter( 'wc_product_sku_enabled', 'bbloomer_remove_product_page_sku' );
 
function bbloomer_remove_product_page_sku( $enabled ) {
    if ( ! is_admin() && is_product() ) {
        return false;
    }
    return $enabled;
}

Is There a Plugin For That?

If youโ€™d love to code but donโ€™t feel 100% confident with PHP, I decided to look for reliable plugins that achieve the same result. As usual, Iโ€™ve chosen WooCommerce plugin vendors based on marketplace reputation, dedicated support quality, code cleanliness, long-term reliability and โ€“ probably almost as importantly โ€“ where the โ€œpeople behindโ€ the plugin are active supporters of the WordPress ecosystem.

1. WooCustomizer

Sold by: WooCustomizer โ€“ Developed by: Zack Viljoen โ€“ 14 Day Money Back Guarantee

Editing the SKU visibility on the single product page is one of the features of WooCustomizer, a plugin built for everyone who wants to fully customize their WooCommerce store without coding (e.g. edit buttons, badges, tabs, pages, stock display, checkout fields).

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

  • WooCommerce Visual Hook Guide: Single Product Page
    Here’s a visual hook guide for the WooCommerce Single Product Page. This is part of my “Visual Hook Guide Series“, through which you can find WooCommerce hooks quickly and easily by seeing their actual locations (and you can copy/paste). If you like this guide and it’s helpful to you, let me know in the comments! […]
  • WooCommerce: Disable Variable Product Price Range $$$-$$$
    You may want to disable the WooCommerce variable product price range which usually looks like $100-$999 when variations have different prices (min $100 and max $999 in this case). With this snippet you will be able to hide the highest price, and add a “From: ” prefix in front of the minimum price. At the […]
  • WooCommerce: Hide Price & Add to Cart for Logged Out Users
    You may want to force users to login in order to see prices and add products to cart. That means you must hide add to cart buttons and prices on the Shop and Single Product pages when a user is logged out. All you need is pasting the following code in your functions.php (please note: […]
  • WooCommerce: Add Custom Field to Product Variations
    Adding and displaying custom fields on WooCommerce products is quite simple. For example, you can add a “RRP/MSRP” field to a product, or maybe use ACF and display its value on the single product page. Easy, yes. Unfortunately, the above only applies to “simple” products without variations (or the parent product if it’s a variable […]
  • WooCommerce: Show Number Of Products Sold @ Product Page
    WooCommerce database already stores the number of products sold for you. Therefore, you may want to show such number on the product page, close to the Add To Cart button. As we’ve seen in my book Ecommerce and Beyond, showing the number of sales for each product can increase your sales conversion rate. All you […]

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

31 thoughts on “WooCommerce: Hide SKU @ Single Product Page

  1. The weirdest thing happened to me with this snippet.
    I always used “code snippets” plugin to add the snippets (95% of them from here), and it always worked perfectly.
    When I added this one the site crashed down with a critical error, and I had to delete de Code Snippets plugin to get things back working.

    However, I downloaded “Woody Add Snippets” plugin and added this snippet, and it worked perfectly!

    I have absolutely no idea of what happened, but is now working

    1. No idea – but using a child theme is a better option

  2. Will this snippet remove the SKU from the Order Complete email too? I’ve had to add the email template to my theme (woocommerce/emails/email-order-items.php) and comment out this line:

    if ( $show_sku && $sku ) {
    // echo wp_kses_post( ‘ (#’ . $sku . ‘)’ );
    }

    …in order to remove the SKU from the emails; but I’d rather use a filter if I could, is that doable?

    I’m using the Woocommerce Product Bundles too, and that just adds the SKU back to any bundled products in my store. I’m hoping if there’s a filter to remove the SKU from just the email it will also work on bundled products too.

    1. Hi Scott, no emails behave in a different way. SKU should show only if it’s an admin email – so if your customers see it, then it’s another plugin/theme messing with it

      1. Thanks for background info, that’s very helpful.

        1. You’re welcome

  3. Great, it’s working! Thank you Rodolfo

    1. Awesome!

  4. I added that snippet to my site and it’s still working fine. I’m running:
    – WordPress 5.2.4
    – WooCommerce 3.7.1
    – Theme: OceanWP 1.7.1

    1. Thank you!

  5. Great snippet.
    Is it possible to only restrict the SKU based on a user’s role?
    For example, it is hidden for “Customers” but not for “Wholesalers”.

    1. Thank you Sam! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  6. Thank you so much for you help. I’ve used 2 of your helpful pages to solve some of my issues.

    With respect to Hiding the SKU, I came accross teh following which worked. I was wondering you suggest which way is best, given i’m far from an expert.

    This is the code:

    add_filter( 'wc_product_sku_enabled', '__return_false' );

    Thanks.

    1. Hi Phil, thanks for your comment ๐Ÿ™‚ Your version hides it everywhere and actually disables it, while mine only hides it on the single product page (yet, the admin can see/use it). Hope this helps

  7. It did work for me but the thing is that the SKU made which was pointing to the product also disappeared! I know you’re going to have the same answer as above! Complimentary and etc. It would be really nice if you reply on mail and help me out!
    Thanks and Cheers!

    1. Hey Aniruddha, thanks for your comment. I didn’t really understand the meaning of “the SKU made which was pointing to the product also disappeared” – can you please explain it again and provide a screenshot? Thanks ๐Ÿ™‚

  8. Hi Rodolfo, using WC 3.3.4, WP 4.9.4, PHP 7.0.28 and works like a charm. Thank you!

  9. Didn’t work for me, while it stopped the SKU being displayed, it also removed the SKU functionality from a plugin I’m using so it started saying the product wasn’t in stock.

    1. Rob, thanks so much for your comment! Unfortunately this is custom plugin troubleshooting work and I cannot help here via the blog comments. Thanks a lot for your understanding! ~R

  10. Thank you man , this worked fine for me. I tried some plugins but with no results ๐Ÿ™‚ .

    1. For noobs, locate the functions.php file from THEME LOCATION, and copy paste the following code on the bottom of your functions.php and save. Instantly the sku n/a will dissapear.

  11. Can we hide product decimals on the front end as well? Thanks. I really like your snippets as they are the correct way of doing things.

    1. Hey there, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  12. Rodolfo, it worked smoothly even on WP 4.8
    Thanks for your help!

    Patrizio Racco

    1. Awesome, thanks Patrizio ๐Ÿ™‚

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

Your email address will not be published. Required fields are marked *