• Resolved Сергей

    (@derevnya)


    How can I remove tabs from the product description using this code?

    /**
    * Remove product data tabs
    */
    add_filter( ‘woocommerce_product_tabs’, ‘woo_remove_product_tabs’, 98 );

    function woo_remove_product_tabs( $tabs ) {

    unset( $tabs[‘description’] ); // Remove the description tab
    unset( $tabs[‘reviews’] ); // Remove the reviews tab
    unset( $tabs[‘additional_information’] ); // Remove the additional information tab

    return $tabs;
    }

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 26 total)
  • Try a code snippets plugin. There are several but this one is popular:
    https://en-gb.www.ads-software.com/plugins/code-snippets/

    Thread Starter Сергей

    (@derevnya)

    Each new plugin adds pros and cons to the site, it is better to add code.

    Then you’ll need to make a child theme:
    https://developer.www.ads-software.com/themes/advanced-topics/child-themes/
    and put the code in functions.php for the child theme.

    Thread Starter Сергей

    (@derevnya)

    Can you just finish the code that I specified?

    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    function woo_remove_product_tabs( $tabs ) {
      unset( $tabs['description'] ); // Remove the description tab
      return $tabs;
    }
    Thread Starter Сергей

    (@derevnya)

    No The tabs are not deleted, the code does not work. (Remove description tab)

    I see you have the Storefront theme. I tested it on Storefront and it worked for me.

    Copy and paste your php code here to check that it is valid:
    https://phpcodechecker.com/

    Ensure your php has used straight quotes and not smart / curly quotes.

    Ensure you have enabled php with a <?php tag somewhere before the snippet.

    Where did you put it? a snippets plugin (which one?) or in functions.php?

    Thread Starter Сергей

    (@derevnya)

    I added code to Appearance – Customize – Additional Styles.

    It won’t work there. Either use a code snippets plugin or functions.php in your child theme.

    Thread Starter Сергей

    (@derevnya)

    functions.php – When updating a theme or plugin, everything will be deleted automatically?

    Yes, so you’ll need to make a child theme:
    https://developer.www.ads-software.com/themes/advanced-topics/child-themes/
    and put the code in functions.php for the child theme.

    Thread Starter Сергей

    (@derevnya)

    I decided to use the Code Snippets plugin.
    And when adding code, the description tab is completely gone.
    I was looking for code that will expand the tabs, that is, the text of all tabs will be displayed simultaneously on the page. I thought this code, which is specified in woocommerce, allows replacing tabs with expanded text.
    How can I remove tabs from the product description using this code?

    /**
    * Remove product data tabs
    */
    add_filter( ‘woocommerce_product_tabs’, ‘woo_remove_product_tabs’, 98 );

    function woo_remove_product_tabs( $tabs ) {

    unset( $tabs[‘description’] ); // Remove the description tab
    unset( $tabs[‘reviews’] ); // Remove the reviews tab
    unset( $tabs[‘additional_information’] ); // Remove the additional information tab

    return $tabs;
    }

    The code is supposed to remove the tabs.

    Now I understand better what you want to do. Forget the code, its not for you. We need to do something different.

    Try this custom css:

    .wc-tabs {
      display: none;
    }
    .woocommerce-tabs .panel {
      width: 100% !important;
    }
    .woocommerce-Tabs-panel {
      display: block !important;
    }

    This code does go in:
    Dashboard > Appearance > Customize > Additional CSS

    We are making the tabs do something they don’t do normally. It may not work completely.

    Thread Starter Сергей

    (@derevnya)

    Works! This look suits me better! Thanks for the support! Can I have another question? On the site “Loop Product Title” capital letters – how to create a normal look?

    ul.products li.product h2.woocommerce-loop-product__title {
      text-transform: capitalize;
    }
Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Code’ is closed to new replies.