Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created August 5, 2013 10:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save corsonr/6154996 to your computer and use it in GitHub Desktop.
Save corsonr/6154996 to your computer and use it in GitHub Desktop.
WooCommerce - Place "related products" within a tab
<?php
/*
* Place this code in functions.php in the theme folder
*/
/*
* Remove related products from product page
*/
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
/*
* Register custom tab
*/
function woo_custom_product_tab( $tabs ) {
$custom_tab = array(
'custom_tab' => array(
'title' => __('Custom Tab','woocommerce'),
'priority' => 9,
'callback' => 'woo_custom_product_tab_content'
)
);
return array_merge( $custom_tab, $tabs );
}
/*
* Place content in custom tab (related products in this sample)
*/
function woo_custom_product_tab_content() {
woocommerce_related_products();
}
add_filter( 'woocommerce_product_tabs', 'woo_custom_product_tab' );
@andreaalcaro
Copy link

you can do the same thing for upsells?

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