Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created October 11, 2023 11:36
Show Gist options
  • Save rwkyyy/2a9a37259d6780fe053138b68d969b55 to your computer and use it in GitHub Desktop.
Save rwkyyy/2a9a37259d6780fe053138b68d969b55 to your computer and use it in GitHub Desktop.
remove woocommerce tabs and add them into separate individual sections
<?php
// Asuming you have a default setup
// we remove the default tabs
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
// alternative (depending on setup):
// add_filter( 'woocommerce_product_tabs', 'my_remove_all_product_tabs', 98 );
// function my_remove_all_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;
// }
// populate sections
// Description
add_action( 'woocommerce_single_product_summary', 'custom_product_description_section', 20 );
function custom_product_description_section() {
echo '<div class="product-description-section">';
the_content();
echo '</div>';
}
// Additional informations
add_action( 'woocommerce_single_product_summary', 'custom_additional_info_section', 25 );
function custom_additional_info_section() {
echo '<div class="additional-info-section">';
woocommerce_output_product_additional_information();
echo '</div>';
}
// Reviews
add_action( 'woocommerce_single_product_summary', 'custom_reviews_section', 30 );
function custom_reviews_section() {
echo '<div class="reviews-section">';
comments_template();
echo '</div>';
}
@rwkyyy
Copy link
Author

rwkyyy commented Oct 11, 2023

for more details on removing some tabs (keeping some of them in tabs) using the alternative method, you got here a full article on this

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