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

Commit 03154a6

Browse files
authored
Fix crash when the user saves Mini Cart Template (#6613)
1 parent c952fa1 commit 03154a6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/Templates/MiniCartTemplate.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
namespace Automattic\WooCommerce\Blocks\Templates;
3+
4+
/**
5+
* MiniCartTemplate class.
6+
*
7+
* @internal
8+
*/
9+
class MiniCartTemplate {
10+
11+
const SLUG = 'mini-cart';
12+
13+
}

src/Utils/BlockTemplateUtils.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use Automattic\WooCommerce\Blocks\Templates\ProductSearchResultsTemplate;
55
use Automattic\WooCommerce\Blocks\Domain\Services\FeatureGating;
6+
use Automattic\WooCommerce\Blocks\Templates\MiniCartTemplate;
67

78
/**
89
* Utility methods used for serving block templates from WooCommerce Blocks.
@@ -283,6 +284,7 @@ public static function get_block_template_description( $template_slug ) {
283284
if ( isset( $plugin_template_types[ $template_slug ] ) ) {
284285
return $plugin_template_types[ $template_slug ]['description'];
285286
}
287+
return '';
286288
}
287289

288290
/**
@@ -313,6 +315,10 @@ public static function get_plugin_block_template_types() {
313315
'title' => _x( 'Product Search Results', 'Template name', 'woo-gutenberg-products-block' ),
314316
'description' => __( 'Template used to display search results for products.', 'woo-gutenberg-products-block' ),
315317
),
318+
MiniCartTemplate::SLUG => array(
319+
'title' => _x( 'Mini Cart', 'Template name', 'woo-gutenberg-products-block' ),
320+
'description' => __( 'Template used to display the Mini Cart drawer.', 'woo-gutenberg-products-block' ),
321+
),
316322
);
317323

318324
return $plugin_template_types;

0 commit comments

Comments
 (0)