Skip to content

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 (woocommerce#5375)

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

* Fix plugin name
  • Loading branch information
Aljullu authored and jonny-bull committed Dec 16, 2021
1 parent 7d3c408 commit cbc71a5
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 cbc71a5

Please sign in to comment.