I would try to rename the custom function and add meta_query
too! So it’d be like this:
function my_shop_custom_products_query( $q ) {
$q->set( 'meta_key', '_thumbnail_id' );
$q->set('orderby', 'meta_value_num');
$q->set('order', 'DESC');
$q->set( 'meta_query', array( array(
'key' => '_thumbnail_id',
'compare' => '>=',
'value' => '0'
)));
}
add_action( 'woocommerce_product_query', 'my_shop_custom_products_query' );
If for some reason it didn’t work, then try to replace meta_value_num
with meta_value
and see if that’d work!