From 2d14756a4f47138bf47702eaf1c6f4f1b6d88dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 13 Dec 2021 15:10:11 +0100 Subject: [PATCH 1/2] Set the origin of custom WC templates to 'plugin' --- src/Utils/BlockTemplateUtils.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Utils/BlockTemplateUtils.php b/src/Utils/BlockTemplateUtils.php index bf8ddebbe6d..2a7289d84dd 100644 --- a/src/Utils/BlockTemplateUtils.php +++ b/src/Utils/BlockTemplateUtils.php @@ -116,6 +116,10 @@ public static function gutenberg_build_template_result_from_post( $post ) { } } + if ( 'woocommerce' === $theme ) { + $template->origin = 'plugin'; + } + return $template; } From 63b0d93a6855047762311e8a3c446eab1cd2cab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Mon, 13 Dec 2021 16:58:24 +0100 Subject: [PATCH 2/2] Fix plugin name --- src/Utils/BlockTemplateUtils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Utils/BlockTemplateUtils.php b/src/Utils/BlockTemplateUtils.php index 2a7289d84dd..8b2e8eb4b6e 100644 --- a/src/Utils/BlockTemplateUtils.php +++ b/src/Utils/BlockTemplateUtils.php @@ -117,6 +117,7 @@ public static function gutenberg_build_template_result_from_post( $post ) { } if ( 'woocommerce' === $theme ) { + $template->theme = 'woocommerce/woocommerce'; $template->origin = 'plugin'; } @@ -137,7 +138,7 @@ public static function gutenberg_build_template_result_from_file( $template_file $template_content = file_get_contents( $template_file->path ); $template = new \WP_Block_Template(); $template->id = 'woocommerce//' . $template_file->slug; - $template->theme = 'WooCommerce'; + $template->theme = 'woocommerce/woocommerce'; $template->content = self::gutenberg_inject_theme_attribute_in_content( $template_content ); $template->source = 'plugin'; $template->slug = $template_file->slug;