Created
August 5, 2013 10:41
-
-
Save corsonr/6154996 to your computer and use it in GitHub Desktop.
WooCommerce - Place "related products" within a tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can do the same thing for upsells?