Commit 9a014d4535c for woocommerce
commit 9a014d4535cfe74e603865f85a7966b377d50977
Author: Albert Juhé Lluveras <contact@albertjuhe.com>
Date: Thu May 21 09:45:06 2026 +0200
Color swatches tweaks (#65216)
* Rename 'wc-visual' attributes from 'Color / Image' to 'Color'
* Show title/tooltip in color swatches
* Add changelog
diff --git a/plugins/woocommerce/changelog/fix-color-swatches-tweaks b/plugins/woocommerce/changelog/fix-color-swatches-tweaks
new file mode 100644
index 00000000000..0dfd753682d
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-color-swatches-tweaks
@@ -0,0 +1,5 @@
+Significance: patch
+Type: fix
+Comment: Color swatches tweaks
+
+
diff --git a/plugins/woocommerce/includes/wc-attribute-functions.php b/plugins/woocommerce/includes/wc-attribute-functions.php
index 2197630c3fa..a4b4229a317 100644
--- a/plugins/woocommerce/includes/wc-attribute-functions.php
+++ b/plugins/woocommerce/includes/wc-attribute-functions.php
@@ -274,7 +274,7 @@ function wc_get_attribute_types() {
}
if ( $allow_visual_attribute_type ) {
- $attribute_types['wc-visual'] = __( 'Color / Image', 'woocommerce' );
+ $attribute_types['wc-visual'] = __( 'Color', 'woocommerce' );
}
return (array) apply_filters(
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php
index a0a87c1add5..a15ac2d1fd8 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php
@@ -102,6 +102,9 @@ final class ProductFilterChips extends AbstractBlock {
<?php if ( ! empty( $item['ariaLabel'] ) ) : ?>
aria-label="<?php echo esc_attr( $item['ariaLabel'] ); ?>"
<?php endif; ?>
+ <?php if ( $has_color_swatches ) : ?>
+ title="<?php echo esc_attr( $item['label'] ); ?>"
+ <?php endif; ?>
value="<?php echo esc_attr( $item['value'] ); ?>"
aria-checked="<?php echo ! empty( $item['selected'] ) ? 'true' : 'false'; ?>"
<?php disabled( ! empty( $item['disabled'] ) ); ?>
@@ -143,6 +146,9 @@ final class ProductFilterChips extends AbstractBlock {
role="checkbox"
data-wp-bind--id="context.item.id"
data-wp-bind--aria-label="context.item.ariaLabel"
+ <?php if ( $has_color_swatches ) : ?>
+ data-wp-bind--title="context.item.label"
+ <?php endif; ?>
data-wp-bind--value="context.item.value"
data-wp-bind--aria-checked="context.item.selected"
data-wp-bind--disabled="context.item.disabled"