-1

After trying every function I could find and 2+ days of trying every snippet possible for functions.php I have been unable to find a working solution for this.

I am trying to remove the WooCommerce description and review tab, and just display the description in place of the tabs, and have the contents of the reviews tab beneath it... with no tabs to click. - I an unset the tabs and remove, but cannot add their contents back in.

I have tried "Remove single product tabs and add the related content instead In Woocommerce" answer code.

I do not mind even overriding php in the theme, but nothing seems to work... the goal is just to have the description show, and the reviews beneath with no tabs. Any help is appreciated.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
M21
  • 343
  • 3
  • 14
  • I tried, it did not work. which is why I didn't mark it! I appreciate your time! – M21 May 30 '20 at 19:26

1 Answers1

4

To remove the tabs but display the content you can use the following.

// Remove
function remove_product_tabs( $tabs ) {
    unset( $tabs['description'] );
    unset( $tabs['reviews'] );
    unset( $tabs['additional_information'] );
    return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'remove_product_tabs', 98, 1 );

// Tabs callback function after single content.
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_product_description_tab' );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_product_additional_information_tab' );
add_action( 'woocommerce_after_single_product_summary', 'comments_template' );

To avoid collapsing, edit the following template

https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/tabs/description.php

  • This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/description.php.

Replace

<?php if ( $heading ) : ?>
    <h2><?php echo esc_html( $heading ); ?></h2>
<?php endif; ?>

<?php the_content(); ?>

With

<div style="clear:both;">
<?php if ( $heading ) : ?>
    <h2><?php echo esc_html( $heading ); ?></h2>
<?php endif; ?>

<?php the_content(); ?>
</div>

Further customization is a matter of html and/or css modifications, depending on your theme

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50