Products with long lists (100+) of variations are difficult to organize into groups. By default we have a drag and drop option but there must be a better way. I've searched for some time now, this code seems to be on the right track:
function ibx_woocommerce_sort_variation(){
if($query->is_admin) {
if ($query->get('post_type') == 'product_variation')
{
$query->set('orderby', 'id');
$query->set('order', 'ASC');
}
}
return $query;
}
add_filter('pre_get_posts','ibx_woocommerce_sort_variation');
But it doesn't work, no sorting happens in admin nor plugins that parse the variations.