Using checkboxes for variations in WooCommerce to allow multiple choice

Solution:

You can do it this way:

1) Edit you content-single-product.php:

2) Get product by $product = wc_get_product( $productId )

3) Check if $product->product_type == “variable”

4) Get all variants of current product and list it to checkboxes:

$variations = $product->get_available_variations();

foreach ( $variations as $variation ) {

$variationId = $variation['variation_id'];

echo '<input type="checkbox" name="variations[]" value="' . $variationId . '" />

}

echo '<input type="checkbox" name="product_id" value="' . $product->ID . '" />

5) After that you can process $_POST and add variations to cart programatically:

if ( !empty( $_POST['variations'] ) ) {

$productId = $_POST['product_id'];
$qty = 1;
$buyVariations = $_POST['variations'];

foreach ( $buyVariations as $variationId ) {

WC()->cart->add_to_cart( $productId, $qty, $variationId );

}

}

6) Sanitization, validation and status messaging is on you, but this process should works.