Last active
March 3, 2021 05:00
-
-
Save neilgee/e82abb3ec22bbdacf27b to your computer and use it in GitHub Desktop.
WooCommerce Tabs
This file contains hidden or 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
//Remove WooCommerce Tabs - this code removes all 3 tabs - to be more specific just remove actual unset lines | |
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); | |
function woo_remove_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; | |
} |
This file contains hidden or 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
//Rename WooCommerce Tabs - this code renames tabs - just include the tab line you want renamed and change the name in paranthesis, ie 'More Information' etc | |
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 ); | |
function woo_rename_tabs( $tabs ) { | |
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab | |
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab | |
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab | |
return $tabs; | |
} |
This file contains hidden or 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
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); | |
/** | |
* Re-order WooCommerce Tabs - this code reorders tabs - the higher the priority(lowest number) goes first | |
* Checks to see if used avoiding undefined notices | |
*/ | |
function woo_reorder_tabs( $tabs ) { | |
if ( isset( $tabs['download_tab'] ) ) { | |
$tabs['download_tab']['priority'] = 5; | |
} | |
if ( isset( $tabs['description'] ) ) { | |
$tabs['description']['priority'] = 10; | |
} | |
if ( isset( $tabs['additional_information'] ) ) { | |
$tabs['additional_information']['priority'] = 15; | |
} | |
return $tabs; | |
} |
This file contains hidden or 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
//Re-order WooCommerce Tabs - this code reorders tabs - the higher the priority(lowest number) goes first | |
add_filter( 'woocommerce_product_tabs', 'woo_reorder_tabs', 98 ); | |
function woo_reorder_tabs( $tabs ) { | |
$tabs['reviews']['priority'] = 5; // Reviews first | |
$tabs['description']['priority'] = 10; // Description second | |
$tabs['additional_information']['priority'] = 15; // Additional information third | |
return $tabs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment