WooCommerce: Hide SKU on the 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        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @sourcecode    https://businessbloomer.com/?p=21715
 * @author        Rodolfo Melogli
 * @compatible    WC 3.4.4
 */

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;
}

Where to add this code?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such delicate files - if you need more guidance, please take a look at my free WooCommerce Customization video tutorial.

Does this snippet still work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free videos, tutorials and tips!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP
  • woocommerce-customize-shop-page-PHP
  • woocommerce-advanced-customization
  • how-to-edit-woocommerce-cart
  • woocommerce-customize-checkout-page-PHP
  • woocommerce-email-customization
  • woocommerce-conditional-logic

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a 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.

21 thoughts on “WooCommerce: Hide SKU on the Single Product Page

  1. 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

  2. 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

  3. 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 πŸ™‚

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

  5. 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

  6. 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.

  7. 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

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

    Patrizio Racco

    1. Awesome, thanks Patrizio πŸ™‚

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.