[Resolved] Hide weight on single product page

Home Forums Support Hide weight on single product page

  • This topic has 7 replies, 2 voices, and was last updated 1 year ago by David.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1014981
    Hannah

    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

    #1015123
    David
    Staff
    Customer Support

    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;
    }
    #1017305
    Hannah

    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

    #1017341
    David
    Staff
    Customer Support

    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.

    #1017361
    Hannah

    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

    #1017368
    David
    Staff
    Customer Support

    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.

    #1017395
    Hannah

    I understood. Thank you so much 🙂

    #1017410
    David
    Staff
    Customer Support
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.