This snippet will query the WordPress database for orpahned WooCommerce product variations. These are product variations that the main product was deleted.
<?php
// This snippet should only be ran in "Manual" mode.
global $wpdb;
$orphaned_variations = $wpdb->get_rows("SELECT * FROM {$wpdb->posts} o LEFT OUTER JOIN {$wpdb->posts} r ON o.post_parent = r.ID WHERE r.id IS null AND o.post_type = 'product_variation'");
echo "There are $orphaned_variations variations on your site.";