Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WooCommerce - Remove product data tabs and hook content in sequence instead
<?php // Do not include this if already open!
/**
* Remove existing tabs from single product pages.
*/
function remove_woocommerce_product_tabs( $tabs ) {
unset( $tabs['description'] );
unset( $tabs['reviews'] );
unset( $tabs['additional_information'] );
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'remove_woocommerce_product_tabs', 98 );
/**
* Hook in each 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' );
@retroriff

This comment has been minimized.

Copy link

@retroriff retroriff commented Oct 23, 2016

Thanks for sharing. However I think that this code shows the description block even if it is empty.

@tinyhazeleyes

This comment has been minimized.

Copy link

@tinyhazeleyes tinyhazeleyes commented Jan 16, 2018

Sweet, thanks for this!

@Ondrejicek

This comment has been minimized.

Copy link

@Ondrejicek Ondrejicek commented Jan 16, 2021

Thank you. But is it possible to add the description/additional information/reviews section only if non-empty?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment