diff --git a/plugins/woocommerce-blocks/src/BlockTemplatesController.php b/plugins/woocommerce-blocks/src/BlockTemplatesController.php index df06d5faf16..e0904954735 100644 --- a/plugins/woocommerce-blocks/src/BlockTemplatesController.php +++ b/plugins/woocommerce-blocks/src/BlockTemplatesController.php @@ -324,8 +324,10 @@ class BlockTemplatesController { } if ( str_contains( $template->slug, 'single-product' ) ) { - if ( ! is_admin() && ! BlockTemplateUtils::template_has_legacy_template_block( $template ) ) { - + // We don't want to add the compatibility layer on the Editor Side. + // The second condition is necessary to not apply the compatibility layer on the REST API. Gutenberg uses the REST API to clone the template. + // More details: https://github.com/woocommerce/woocommerce-blocks/issues/9662. + if ( ( ! is_admin() && ! ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) && ! BlockTemplateUtils::template_has_legacy_template_block( $template ) ) { $new_content = SingleProductTemplateCompatibility::add_compatibility_layer( $template->content ); $template->content = $new_content; }