@@ -137,6 +137,10 @@ public static function init() {
137137 add_filter ( 'option_gutenberg-experiments ' , array ( __CLASS__ , 'enable_gutenberg_react_19_experiment ' ) );
138138 add_filter ( 'default_option_gutenberg-experiments ' , array ( __CLASS__ , 'enable_gutenberg_react_19_experiment ' ) );
139139
140+ // Allow blog stickers to override the WooCommerce unified block editor assets option.
141+ add_filter ( 'option_woocommerce_feature_block_editor_unified_assets_enabled ' , array ( __CLASS__ , 'enable_woocommerce_block_editor_unified_assets ' ) );
142+ add_filter ( 'default_option_woocommerce_feature_block_editor_unified_assets_enabled ' , array ( __CLASS__ , 'enable_woocommerce_block_editor_unified_assets ' ) );
143+
140144 if ( wpcom_has_blog_sticker ( 'gutenberg-extensible-site-editor ' , get_wpcom_blog_id () ) ) {
141145 add_filter ( 'option_gutenberg-experiments ' , array ( __CLASS__ , 'enable_extensible_site_editor_experiment ' ) );
142146
@@ -1012,6 +1016,48 @@ public static function enable_gutenberg_react_19_experiment( $experiments ) {
10121016 return $ experiments ;
10131017 }
10141018
1019+ /**
1020+ * Override the WooCommerce unified block editor assets option with blog stickers.
1021+ *
1022+ * The `wc-disable-block-editor-unified-assets` blog sticker force-disables the feature,
1023+ * while the `wc-block-editor-unified-assets` sticker opts the site in.
1024+ *
1025+ * @since $$next-version$$
1026+ *
1027+ * @param mixed $enabled The current feature option value.
1028+ * @return mixed Original option value, `yes` when enabled, or `no` when force-disabled.
1029+ */
1030+ public static function enable_woocommerce_block_editor_unified_assets ( $ enabled ) {
1031+ $ blog_id = get_wpcom_blog_id ();
1032+
1033+ if ( wpcom_has_blog_sticker ( 'wc-disable-block-editor-unified-assets ' , $ blog_id ) ) {
1034+ return 'no ' ;
1035+ }
1036+
1037+ if ( wpcom_has_blog_sticker ( 'wc-block-editor-unified-assets ' , $ blog_id ) ) {
1038+ return 'yes ' ;
1039+ }
1040+
1041+ // phpcs:disable Squiz.PHP.CommentedOutCode.Found,Squiz.Commenting.BlockComment.NoCapital -- Preserve the rollout for future activation.
1042+
1043+ /*
1044+ if ( function_exists( 'wpcomsh_get_atomic_site_id' ) ) {
1045+ $site_id = wpcomsh_get_atomic_site_id();
1046+
1047+ if ( $site_id ) {
1048+ $current_segment = 1; // Segment of Atomic sites in the experiment, in %.
1049+
1050+ if ( $site_id % 100 < $current_segment ) {
1051+ return 'yes';
1052+ }
1053+ }
1054+ }
1055+ */
1056+ // phpcs:enable
1057+
1058+ return $ enabled ;
1059+ }
1060+
10151061 /**
10161062 * Whether the site runs a Gutenberg plugin release that's known to break with React 19.
10171063 *
0 commit comments