Hello,
The weight and dimensions show up when there is information added on the back-end. If you leave them blank, they won’t show.
If you’d like to keep the information on the back-end, but hide from the front-end, you can use the following code:
add_filter( 'woocommerce_product_get_weight' , '__return_false' );
add_filter( 'wc_product_enable_dimensions_display', '__return_false' );
This code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code Snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update.
Thread Starter
spyras
(@spyras)
Hello!
I put this code into the functions.php child theme, but when I refresh homepage i get “There has been a critical error on this website”
Any idea why?
I received mail with sone details:
An error of type E_PARSE was caused in line 1 of the file /var/www/vhosts/site_name/httpdocs/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(221) : eval()’d code. Error message: syntax error, unexpected ‘&’
Regards
-
This reply was modified 5 years, 1 month ago by
spyras.
-
This reply was modified 5 years, 1 month ago by
spyras.
Hello,
It looks like there is unnecessary & in your code. Can you copy and paste the code from my earlier reply and check if it works?
Hi @spyras,
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.
Thanks!