Commit fd2e7c9948e for woocommerce
commit fd2e7c9948ecab5fac92f8dfc1ec4fd100816127
Author: Tung Du <dinhtungdu@gmail.com>
Date: Wed Sep 9 22:47:29 2026 +0700
Document preferred block styling APIs (#68486)
Add block styling API guidance
diff --git a/AGENTS.md b/AGENTS.md
index 121ad660193..fad8d86c886 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -248,6 +248,10 @@ WooCommerce names its enumerated string vocabularies — order statuses, product
## Block Development
+### Block Styling
+
+Prefer Core Block Supports. For explicit style generation, use `wp_style_engine_get_styles()`. Avoid new `StyleAttributesUtils` usages; migrate existing ones when touched, preserving rendered styles.
+
### `block.json` Attribute Defaults
Never include styling options such as `fontSize`, `borderColor`, `textColor`... as block attributes. They should only be listed under `supports`.
diff --git a/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php b/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php
index 8ce4df2330b..883481304b4 100644
--- a/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php
+++ b/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php
@@ -3,6 +3,9 @@ namespace Automattic\WooCommerce\Blocks\Utils;
/**
* StyleAttributesUtils class used for getting class and style from attributes.
+ *
+ * Prefer Core Block Supports. For explicit style generation, use wp_style_engine_get_styles().
+ * Avoid new uses of this class; migrate existing ones when touched, preserving rendered styles.
*/
class StyleAttributesUtils {