Skip to content

Instantly share code, notes, and snippets.

@digitalchild
Created August 7, 2021 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalchild/a4770e3629d6f53f17bc9cfbe797181a to your computer and use it in GitHub Desktop.
Save digitalchild/a4770e3629d6f53f17bc9cfbe797181a to your computer and use it in GitHub Desktop.
Change the Product Tab order in WC Vendors Pro Product Edit form
<?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