Commit 5fb08bdc3cd for woocommerce

commit 5fb08bdc3cd394aa3748f1e74e46bf0681e85183
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date:   Fri Oct 9 18:49:15 2026 +0200

    Add product type classes to the Add to Cart + Options block in legacy mode (#69408)

    * Add product type classes to the Add to Cart + Options in legacy mode

    * Add changelog

diff --git a/plugins/woocommerce/changelog/add-extra-classic-add-to-cart-with-options-legacy-mode b/plugins/woocommerce/changelog/add-extra-classic-add-to-cart-with-options-legacy-mode
new file mode 100644
index 00000000000..f123d002466
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-extra-classic-add-to-cart-with-options-legacy-mode
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Add product type classes to the Add to Cart + Options block in legacy mode
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php b/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php
index a4311cd8267..a2f919667ab 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php
@@ -554,7 +554,14 @@ class AddToCartWithOptions extends AbstractBlock {
 			$form_attributes         = '';
 			$legacy_mode             = 'yes' === $cart_redirect_after_add || $this->has_form_elements( $hooks_before ) || $this->has_form_elements( $hooks_after );
 			if ( $legacy_mode ) {
-				$action_url = BlocksUtils::get_current_page_url();
+				$action_url   = BlocksUtils::get_current_page_url();
+				$form_classes = 'cart';
+
+				if ( ProductType::VARIABLE === $product_type ) {
+					$form_classes .= ' variations_form';
+				} elseif ( ProductType::GROUPED === $product_type ) {
+					$form_classes .= ' grouped_form';
+				}

 				// If an extension is hooking into the form or we need to redirect to the cart,
 				// we fall back to a regular HTML form.
@@ -571,7 +578,7 @@ class AddToCartWithOptions extends AbstractBlock {
 					),
 					'method'  => 'post',
 					'enctype' => 'multipart/form-data',
-					'class'   => 'cart',
+					'class'   => $form_classes,
 				);
 			} else {
 				// Otherwise, we use the Interactivity API.