Created
August 7, 2021 04:38
-
-
Save digitalchild/a4770e3629d6f53f17bc9cfbe797181a to your computer and use it in GitHub Desktop.
Change the Product Tab order in WC Vendors Pro Product Edit form
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 | |
// Add this to your themes functions.php | |
// Here are two different ways you can sort the product tabs | |
// Use ksort to alphabetically sort the tabs | |
add_filter( 'wcv_product_meta_tabs', 'wcv_change_product_tab_order_alphabetical' ); | |
function wcv_change_product_tab_order_alphabetical( $tabs ){ | |
ksort( $tabs ); | |
return $tabs; | |
} | |
// Manually change the order by moving the line order around | |
add_filter( 'wcv_product_meta_tabs', 'wcv_change_product_tab_order_manual' ); | |
function wcv_change_product_tab_order_manual( $tabs ){ | |
WC_Vendors::log( array_keys( $tabs ) ); | |
$new_tabs = array(); | |
$new_tabs[ 'general' ] = $tabs[ 'general' ]; | |
$new_tabs[ 'seo' ] = $tabs[ 'seo' ]; | |
$new_tabs[ 'shipping' ] = $tabs[ 'shipping' ]; | |
$new_tabs[ 'inventory' ] = $tabs[ 'inventory' ]; | |
$new_tabs[ 'attribute' ] = $tabs[ 'attribute' ]; | |
$new_tabs[ 'variations' ] = $tabs[ 'variations' ]; | |
$new_tabs[ 'linked_product' ] = $tabs[ 'linked_product' ]; | |
return $new_tabs; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment