Commit 1aa09f5693 for woocommerce
commit 1aa09f5693d9fff6a9561569b45833355603a988
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Wed Jan 7 17:16:03 2026 +0100
Refactor Add to Cart + Options grouped product template part to decrease the gap between quantity selector and product name (#62702)
* Refactor Add to Cart + Options grouped product template part to decrease the gap between quantity selector and product name
* Add changelog file
* Prevent the new layout affecting existing template parts
* Make selector more specific
diff --git a/plugins/woocommerce/changelog/fix-62464-add-to-cart-with-options-grouped-product-gap b/plugins/woocommerce/changelog/fix-62464-add-to-cart-with-options-grouped-product-gap
new file mode 100644
index 0000000000..964379c829
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-62464-add-to-cart-with-options-grouped-product-gap
@@ -0,0 +1,4 @@
+Significance: patch
+Type: update
+
+Refactor Add to Cart + Options grouped product template part to decrease the gap between quantity selector and product name
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/style.scss b/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/style.scss
index da1e9feda9..0ce9106655 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/style.scss
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/add-to-cart-with-options/grouped-product-selector/product-item-selector/style.scss
@@ -1,5 +1,13 @@
@import "../../../../base/components/quantity-selector/style";
+// This will make sure buttons and checkboxes take at least the same width as
+// the quantity selector. Buttons might still be wider in certain locales.
+// We exclude grid layouts to avoid changing the previous default layout.
+// See https://github.com/woocommerce/woocommerce/pull/62702.
+:where(.wp-block-group.is-layout-flex:not(.is-vertical) > .wc-block-add-to-cart-with-options-grouped-product-item-selector) {
+ min-width: 6.8em;
+ text-align: right;
+}
:where(.wc-block-add-to-cart-with-options-grouped-product-item-selector .button) {
display: inline-flex;
}
diff --git a/plugins/woocommerce/templates/parts/grouped-product-add-to-cart-with-options.html b/plugins/woocommerce/templates/parts/grouped-product-add-to-cart-with-options.html
index 0d69deffe1..5e296b3d1e 100644
--- a/plugins/woocommerce/templates/parts/grouped-product-add-to-cart-with-options.html
+++ b/plugins/woocommerce/templates/parts/grouped-product-add-to-cart-with-options.html
@@ -8,7 +8,7 @@
class="wp-block-woocommerce-add-to-cart-with-options-grouped-product-item"
role="listitem"
>
- <!-- wp:group {"style":{"spacing":{"margin":{"top":"1rem","bottom":"1rem"}}},"layout":{"type":"grid","columnCount":3,"minimumColumnWidth":null}} -->
+ <!-- wp:group {"style":{"spacing":{"margin":{"top":"1rem","bottom":"1rem"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left"}} -->
<div
class="wp-block-group"
style="margin-top: 1rem; margin-bottom: 1rem"