Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Set the origin of custom templates to 'plugin' and fix plugin name on…
Browse files Browse the repository at this point in the history
… REST requests (#5375)

* Set the origin of custom WC templates to 'plugin'

* Fix plugin name
  • Loading branch information
Aljullu authored Dec 15, 2021
1 parent 6d398e8 commit 49943fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Utils/BlockTemplateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public static function gutenberg_build_template_result_from_post( $post ) {
}
}

if ( 'woocommerce' === $theme ) {
$template->theme = 'woocommerce/woocommerce';
$template->origin = 'plugin';
}

return $template;
}

Expand All @@ -133,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;
Expand Down

0 comments on commit 49943fd

Please sign in to comment.