WooCommerce – Add to cart without variation id

Solution:

You could borrow some code from the WC_Ajax::get_variation() method since that runs when you use select the attributes for a normal variable product.

$data_store   = WC_Data_Store::load( 'product' );
$variation_id = $data_store->find_matching_product_variation( $variable_product, wp_unslash( $_POST ) );

Requires WooCommerce 3.0+