diff --git a/docs/testing/releases/673.md b/docs/testing/releases/673.md new file mode 100644 index 00000000000..ed3e5b019d8 --- /dev/null +++ b/docs/testing/releases/673.md @@ -0,0 +1,11 @@ +## Testing notes and ZIP for release 6.7.3 + +Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-gutenberg-products-block/files/7924587/woocommerce-gutenberg-products-block.zip) + +## Feature plugin and package inclusion in WooCommerce + +### Enable Mini Cart template-parts only for experimental builds ([5606](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5606)) + +1. Install Gutenberg (or use WordPress 5.9) and select a block theme e.g. `TT1 Blocks`. +2. Open Appearance > Editor > Templates Parts. +3. Check that `Mini Cart` template is NOT visible. diff --git a/docs/testing/releases/README.md b/docs/testing/releases/README.md index 8f7efe36f18..f8dbe667a8e 100644 --- a/docs/testing/releases/README.md +++ b/docs/testing/releases/README.md @@ -56,4 +56,5 @@ Every release includes specific testing instructions for new features and bug fi - [6.6.0](./660.md) - [6.7.0](./670.md) - [6.7.1](./671.md) - - [6.7.2](./672.md) \ No newline at end of file + - [6.7.2](./672.md) + - [6.7.3](./673.md) diff --git a/package-lock.json b/package-lock.json index cc54d6d3251..c998cf1d2ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@woocommerce/block-library", - "version": "6.7.0-dev", + "version": "6.7.3-dev", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@woocommerce/block-library", - "version": "6.7.0-dev", + "version": "6.7.3-dev", "hasInstallScript": true, "license": "GPL-3.0+", "dependencies": { diff --git a/package.json b/package.json index bed0099f30c..d9b6d56a977 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@woocommerce/block-library", "title": "WooCommerce Blocks", "author": "Automattic", - "version": "6.7.2", + "version": "6.7.3", "description": "WooCommerce blocks for the Gutenberg editor.", "homepage": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/", "keywords": [ diff --git a/readme.txt b/readme.txt index fb6a69dfa5d..b028906f844 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks Requires at least: 5.8 Tested up to: 5.8 Requires PHP: 7.0 -Stable tag: 6.7.2 +Stable tag: 6.7.3 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -85,6 +85,12 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/ == Changelog == += 6.7.3 - 2022-01-24 = + +#### Bug Fixes + +- Enable Mini Cart template parts only for experimental builds. ([#5606](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5606)) + = 6.7.2 - 2022-01-17 = #### Bug Fixes diff --git a/src/BlockTemplatesController.php b/src/BlockTemplatesController.php index 437c4e044e5..d5bdda9cfed 100644 --- a/src/BlockTemplatesController.php +++ b/src/BlockTemplatesController.php @@ -369,12 +369,14 @@ function ( $template ) use ( $template_slug ) { * @param array $slugs An array of slugs to retrieve templates for. * @param array $template_type wp_template or wp_template_part. * - * @return array + * @return array WP_Block_Template[] An array of block template objects. */ public function get_block_templates( $slugs = array(), $template_type = 'wp_template' ) { $templates_from_db = $this->get_block_templates_from_db( $slugs, $template_type ); $templates_from_woo = $this->get_block_templates_from_woocommerce( $slugs, $templates_from_db, $template_type ); - return array_merge( $templates_from_db, $templates_from_woo ); + $templates = array_merge( $templates_from_db, $templates_from_woo ); + return BlockTemplateUtils::filter_block_templates_by_feature_flag( $templates ); + } /** diff --git a/src/Domain/Services/FeatureGating.php b/src/Domain/Services/FeatureGating.php index 4431fdfbc0d..ee9fdb400aa 100644 --- a/src/Domain/Services/FeatureGating.php +++ b/src/Domain/Services/FeatureGating.php @@ -137,4 +137,32 @@ public function is_production_environment() { public function is_test_environment() { return self::TEST_ENVIRONMENT === $this->environment; } + + /** + * Returns core flag value. + * + * @return number + */ + public static function get_core_flag() { + return self::CORE_FLAG; + } + + /** + * Returns feature plugin flag value. + * + * @return number + */ + public static function get_feature_plugin_flag() { + return self::FEATURE_PLUGIN_FLAG; + } + + /** + * Returns experimental flag value. + * + * @return number + */ + public static function get_experimental_flag() { + return self::EXPERIMENTAL_FLAG; + } + } diff --git a/src/Package.php b/src/Package.php index 32f28e663af..827f6378441 100644 --- a/src/Package.php +++ b/src/Package.php @@ -106,7 +106,7 @@ public static function container( $reset = false ) { NewPackage::class, function ( $container ) { // leave for automated version bumping. - $version = '6.7.2'; + $version = '6.7.3'; return new NewPackage( $version, dirname( __DIR__ ), diff --git a/src/Utils/BlockTemplateUtils.php b/src/Utils/BlockTemplateUtils.php index 26463d3952a..8ad698e28fc 100644 --- a/src/Utils/BlockTemplateUtils.php +++ b/src/Utils/BlockTemplateUtils.php @@ -1,6 +1,9 @@ get_flag(); + + /** + * An array of block templates with slug as key and flag as value. + * + * @var array + */ + $block_templates_with_feature_gate = array( + 'mini-cart' => $feature_gating->get_experimental_flag(), + ); + + return array_filter( + $block_templates, + function( $block_template ) use ( $flag, $block_templates_with_feature_gate ) { + if ( isset( $block_templates_with_feature_gate[ $block_template->slug ] ) ) { + return $block_templates_with_feature_gate[ $block_template->slug ] <= $flag; + } + return true; + } + ); + } + } diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index 1ba163417ac..a07480cdc51 100644 --- a/woocommerce-gutenberg-products-block.php +++ b/woocommerce-gutenberg-products-block.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Blocks * Plugin URI: https://github.com/woocommerce/woocommerce-gutenberg-products-block * Description: WooCommerce blocks for the Gutenberg editor. - * Version: 6.7.2 + * Version: 6.7.3 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woo-gutenberg-products-block