Archived topic
Hide weight on single product page
7 replies · Started by _blank on September 20, 2019
Hello,
is there a way to hide only the weight on the single product page but keep the description in the product tabs?
Thanks for the info :)
Best
Hannah
Hi there,
try this PHP filter snippet to unset that tab:
add_filter( 'woocommerce_product_tabs', 'db_remove_product_tabs', 98 );
function db_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}
Hello, thank you very much. I tried to admit with the plugin insert php but its not working. Unfortunately I always only add CSS and I don't have any experience with PHP.
Is there also a CSS or could you guide me to add the PHP filter?
Thank you so so much
All the best
Hannah
We provide this guide on adding PHP:
https://docs.generatepress.com/article/adding-php/
The Code Snippets plugin is the one we recommend if you're not using a child theme.
HI David,
thank you so much. I used Code Snippets and it worked wonderful. The only thing: I DO have a child theme. What could be a problem or why would you only recommend it in case I am not using one?
Thanks a lot :)
Best wishes
Hannah
No problems if you have a child theme and the code snippets plugin.
If you're confident at editing the child themes function.php then you can have one less plugin. But the plugin bears no weight on the front end of the site so this is not an issue.
My only word on using plugins to add code is if there are other admin users who could mistakingly disable the plugin or edit the code.
I understood. Thank you so much :)
You're welcome