How to hide SKU number on product page

Rachelle

New Member
Hi,

I notice that once clicking on product thumb image which opens the product detail page, I can see the SKU number above category field.

I copy this SKU number to browser, and it links to many products online with the exact product description of Aliexpress to a degree. I think most of us like to edit for our on site so it appears exclusive to our site.

How can the SKU number / field be hidden on the front-end side while keeping it on the admin side?
 

Attachments

  • sku - hide issue.jpg
    sku - hide issue.jpg
    22.6 KB · Views: 24

Christina

Administrator
Hi,

I notice that once clicking on product thumb image which opens the product detail page, I can see the SKU number above category field.

I copy this SKU number to browser, and it links to many products online with the exact product description of Aliexpress to a degree. I think most of us like to edit for our on site so it appears exclusive to our site.

How can the SKU number / field be hidden on the front-end side while keeping it on the admin side?

Hello, Rachelle.

You can hide the SKU number with the help of CSS. Just search "how to hide SKU on WooCommerce Product Page" in Google.
 

Mar

Moderator
Hi,

I notice that once clicking on product thumb image which opens the product detail page, I can see the SKU number above category field.

I copy this SKU number to browser, and it links to many products online with the exact product description of Aliexpress to a degree. I think most of us like to edit for our on site so it appears exclusive to our site.

How can the SKU number / field be hidden on the front-end side while keeping it on the admin side?
Add the code in functions.php:

function sv_remove_product_page_skus( $enabled ) {
if ( ! is_admin() && is_product() ) {
return false;
}

return $enabled;
}
add_filter( 'wc_product_sku_enabled', 'sv_remove_product_page_skus' );

It will remove the SKU display in the product page but not in the admin side.
 

Rachelle

New Member
Hi,

First thank you for your very quick reply I tried the to copy code to fuction.php per your instructions. The code displayed on the top of my theme on every page, so maybe I did something wrong there. However, I found a plugin at https://wordpress.org/plugins/woocommerce-remove-sku/ that worked great. Downloaded it, then uploaded via add / upload. plugin option. Then Update the plugin settings in your WooCommerce settings at WooCommerce > Settings > SKU settings pages where it has created an additional tag-option for SKU Hide Option (see attached). Solved.

Thank you for your guidance.
 

Attachments

  • sku - hide issue-solved-1.jpg
    sku - hide issue-solved-1.jpg
    10.8 KB · Views: 17
  • sku - hide issue-solved-2.jpg
    sku - hide issue-solved-2.jpg
    46.2 KB · Views: 13

Mar

Moderator
Hi,

First thank you for your very quick reply I tried the to copy code to fuction.php per your instructions. The code displayed on the top of my theme on every page, so maybe I did something wrong there. However, I found a plugin at https://wordpress.org/plugins/woocommerce-remove-sku/ that worked great. Downloaded it, then uploaded via add / upload. plugin option. Then Update the plugin settings in your WooCommerce settings at WooCommerce > Settings > SKU settings pages where it has created an additional tag-option for SKU Hide Option (see attached). Solved.

Thank you for your guidance.
I've been using the code long before and it worked in my end. Apparently, you missed something, good that it did not break your site, you know adding codes to functions.php is delicate and I assumed you are familiar with it. Anyway, if the plugin work, you got he same result and I am sure it would help other members in the forum.
 

Direct Webstore

Well-Known Member
... and remember..if you edit the functions.php file..keep a copy of it as it will be overwritten with your next theme update...unless you use a child theme.
 

Direct Webstore

Well-Known Member
EDIT: Sorry about the previous mention to put this in Additional CSS. Must have been half asleep ... I've posted this method several times in this forum.
Paste this into functions.php. It will only disable it on the Product page.

EDIT: Be sure to paste it in the correct place. It should be the last entry and above any comments.

function sv_remove_product_page_skus( $enabled ) {
if ( ! is_admin() && is_product() ) {
return false;
}

return $enabled;
}
add_filter( 'wc_product_sku_enabled', 'sv_remove_product_page_skus' );

EDIT: Just noticed Mar posted this solution as well. Oh well, the more the merrier. :)
 
Last edited:

bski

New Member
I got errors that threatened to break my site when I tried Direct Webstore's code above. :\ This worked for me :

Paste the following code into Appearance/Customize/Additional CSS

.product .sku_wrapper { display: none !important; }
 
Last edited:

Direct Webstore

Well-Known Member
If it's not copied correctly and placed correctly, it will return errors. functions.php is very touchy. But it works well for most experienced people.
Be sure to paste it in the correct place.

EDIT: It should be the last entry and above any comments.

:)
 
Last edited:

bski

New Member
If it's not copied correctly and placed correctly, it will return errors. functions.php is very touchy. But it works well for most experienced people. :)
I see that you edited your post (#7) 37 minutes ago to say "Paste this into functions", when what you originally said was "Paste the following code into Appearance/Customize/Additional CSS". I know this because I copy and pasted your instructions into my subsequent post.

If one follows your original instructions they will, indeed, get errors that threaten to break their site.

This is not an issue of experience, or the lack thereof as you insinuated. This was an issue of you giving poor instructions, or your inexperience in knowing where to paste the code. It's ok, it happens to the best of us. However, maybe next time you could admit that you made a mistake instead of suggesting that the error is with others - and tooting your own horn in the process. For what it's worth, I'm new here and by no means a programmer, but I'm definitely not new to copy and paste ... or Wordpress.
 
Last edited:

Direct Webstore

Well-Known Member
I see that you edited your post (#7) 37 minutes ago to say "Paste this into functions", when what you originally said was "Paste the following code into Appearance/Customize/Additional CSS".

That's right. Must have been half asleep at the time. LOL. It's obviously not CSS code. Probably because I posted the CSS code for hiding it and the PHP functions code for disabling elsewhere on this forum already. :)

If one follows your original instructions they will, indeed, get errors that threaten to break their site.

Actually, if that was pasted into Additional CSS or the style.css file itself, it would have no effect at all. Apart from the Additional CSS section complaining about it with red errors.

This was an issue of you giving poor instructions,
On my part, yes. But it's the same as Mar's. (Except for the CSS blooper) If used correctly in functions.php, it works. It's working perfectly with Flatsome theme on all 7 of my sites right now.

I'm new here and by no means a programmer, but I'm definitely not new to copy and paste ... or Wordpress.
Good on ya. You just need to practise recognising the obvious difference between CSS code and PHP code. :)

you giving poor instructions, or your inexperience in knowing where to paste the code. It's ok, it happens to the best of us.
Be sure to paste it in the correct place. It should be the last entry and above any comments. Sorry I did not mention that earlier. I must be getting sick of posting this solution. LOL. I have edited the instructions.

I originally had a problem too, then I used Google to discover why. Don't worry, the inability to use Google happens to the best of people.

Even the inability to use the search function in this forum is a struggle for many because as I mentioned above ... this topic has been covered and answered by me (and Mar) several times. With the correct instructions.:)

The functions.php way is the best solution though. It disables the function. The CSS method just hides the SKU, but the function is still running plus the extra resources to run the CSS code is also running, adding to the page loading time. As little as it is. But every little bit adds up.

:)
 
Last edited:

OmarAbdAlaziz

New Member
Hi,

I notice that once clicking on product thumb image which opens the product detail page, I can see the SKU number above category field.

I copy this SKU number to browser, and it links to many products online with the exact product description of Aliexpress to a degree. I think most of us like to edit for our on site so it appears exclusive to our site.

How can the SKU number / field be hidden on the front-end side while keeping it on the admin side?

Thank you
I was searching How to remove it and this plugin worked well , Thank you
 

bski

New Member
Actually, if that was pasted into Additional CSS or the style.css file itself, it would have no effect at all. Apart form the CSS section complaining about it with red errors.
Exactly, many red errors indicating that saving the code may break the site. That's what I said.

But it's the same as Mar's. (Except for the CSS
Riiiiiight. Except Mar said to paste the code into functions.php and you said to paste it into CSS. Not only did you say to add it as custom CSS, you gave explicit instructions on exactly how to navigate to the custom CSS section. It's not even remotely the same, and it wasn't a matter of typing "CSS" instead of "functions.php". LOL

You just need to practise recognising the obvious difference between CSS code and PHP code
I am not a coder - I don't claim to be, but then I'm not the one giving bad coding advice and pretending it was user error when it doesn't work. Frankly, it wasn't even your advice, it was Mar's code that you copied and then amended with explicit instruction on how to insert it in the wrong place. So while you're doling out advice on personal improvement, maybe you could brush up on a few things yourself, starting with humility...and spelling. I believe you meant 'practice' and 'recognizing'. Just saying.

I won't be responding to you any further, despite the snide comments that are sure to follow. With that in mind, here's some unsolicited advice back at ya' - tame the egotistical, know-it-all act in the forums, especially in light of this glaring "blooper", to use your term. Forums should be a safe place to learn and ask dumb questions without judgement, and to get answers from people who either KNOW the answer, or have enough sense to be quiet and let someone who does know weigh in. The forums are not here for the benefit of your ego, to regurgitate (poorly) reworded Moderator suggestions, or as a platform to showboat about how many websites you built with other people's coding in the form of plugins.

BTW, my solution works beautifully on Flatsome; it's my theme also. If you don't want your functions.php overwritten with every update, consider giving it a try.
 

Direct Webstore

Well-Known Member
Exactly, many red errors indicating that saving the code may break the site. That's what I said.
No. It won't "break" the site ... or make it explode either. lol :) It simply won't have any effect at all if it was pasted into style.css and it wouldn't even save at all in Appearance>Additional CSS. You're being overly dramatic. Basically, it would be 100% impossible to "break" your site.

Except Mar said to paste the code into functions.php and you said to paste it into CSS
You're a pedantic twat, aren't you?

Like I said, I've written the correct procedure several times in this forum. So I get tired of writing it yet again (ZZZzzz) for people too lazy to do a search and I make a mistake. It was probably late at night ... as usual. I'm human. Deal with it. :)

BTW, my solution works beautifully on Flatsome
Yes. The CSS does work. I've also written about that elsewhere in this forum. But it's not the most efficient. I used to use too it until I discovered the much better functions.php method via Google. (Try it sometime) But if you're happy with it. Fantastic. ;)

I won't be responding to you any further
Thank God for that ... lol :)
 
Last edited:
Top