Skip to content

Instantly share code, notes, and snippets.

@buley
Forked from ChromeOrange/functions.php
Last active August 29, 2015 14:28
Show Gist options
  • Save buley/74126456b327ed7cbcb7 to your computer and use it in GitHub Desktop.
Save buley/74126456b327ed7cbcb7 to your computer and use it in GitHub Desktop.
Managing WooCommerce Product Tabs
<?php
/**
* Standard Tab Code from woocommerce-hooks.php
*/
/* Product page tabs */
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
/**
* Removing a tab
* Add the following to your theme functions file to remove the reviews tab
*/
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
/**
* Reordering the tabs
* First they must be removed and then added again in the order you would like by changing the priority
* If you use the WooCommerce Custom Product Tabs Lite plugin that has a priority of 25
*
* Add the following to you theme functions file
* This code will allow the Tab Manager tab to be first, then attributes, the description, then reviews
*/
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 20 );
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30 );
/* Product page tabs */
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 40 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 30 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 50 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 40 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_attributes_panel', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 50 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment