Change default sort order in woocommerce dashboard and sort products alphabetically

If you want to change the order of your products in the Woocommerce dashboard, it can be done very easily. It is as simple as inserting the below code into your current theme functions.php file.

function set_post_order_in_admin($wp_query)
	if (!$wp_query->is_main_query() || 'product' != $wp_query->get('post_type')) {
	$wp_query->set('orderby', 'title');
	$wp_query->set('order', 'ASC');

add_filter('pre_get_posts', 'set_post_order_in_admin', 5);

With the above code, your products will now be sorted alphabetically in your WordPress dashboard.