From a917c98649ff70fa4ad0b2f5b0311b245cc8aee9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 19:58:38 -0300 Subject: [PATCH] Release: 10.9.3 (#10725) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Empty commit for release pull request * Fix "On sale" badge class (#10634) * Fix "On sale" badge class for shop * Add class to sale badge * Remove client side navigation from Products beta block (#10636) * Remove client side navigation from Products beta block Changes: - Removed the `add_navigation_id_directive` method and its associated filter. This method previously added a `data-wc-navigation-id` attribute to the query block for client-side navigation, which is no longer required. - Removed the `add_navigation_link_directives` method and its associated filter. This method previously added interactive directives to pagination links inside the Query Pagination block. This specific functionality has been removed as it is no longer needed. - Introduced a new method `mark_block_as_interactive`, which is designed to mark the Product Query as an interactive region so that interactive elements can work inside it. This is achieved using the 'data-wc-interactive' attribute. * add data-wc-interactive to product button block * Remove unnecessary code As we have added `data-wc-interactive` on Product button therefore we don't need to add it in Product Query block. * Boolean attribute doesn't need explicit value equal to true * Skip failing i18n-related E2E tests * Skip failing i18n-related E2E test --------- Co-authored-by: Luigi Co-authored-by: Niels Lange * Update WooCommerce Blocks brand assets (#10622) * Update testing instructions * Update changelog * Fix version number of testing instructions * Update testing notes * Update testing ZIP file * Update version number * Empty commit for release pull request * Load Interactivity API in `bootstrap.php` (#10657) * load Interactivity API in Bootstrap.php file * fix comment * update visibility function * remove blank line * remove comment * remove logic to not load Interactivity API * Empty commit for release pull request * Add readme file * Update testing instructions * Change versions * Update zip * Update 1092.md * Update 1092.md * Make View Cart link displayed below the Add to Cart button (#10675) * Update testing instructions * Update testing notes * Fix: Made migration migrate block templates in the current theme (#10641) * Fix: Made migration migrate block templates in the current theme * Update src/BlockTemplatesController.php Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Move migration and status codes to BlockTemplateMigrationUtils --------- Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> * Fix: sync_endpoint_with_page should use a matching slug if it exists instead of creating a new page (#10640) * Fix/10530 Inconsistent new install behaviour for templates when using block themes (#10608) * Skipped requests regarding WP/WC setup, to avoid issues with the pages not existing yet when migrating page content to templates. * Skipped requests regarding WP-CLI to avoid issues with the pages not existing yet when migrating page content to templates. * Added check for woocommerce_db_version option * Add check for occurred migration to skip template injection * corrected if clause * Update src/BlockTemplatesController.php Co-authored-by: Mike Jolley * Added maintenance mode to migration exception. Added trace value to has_migrated options * Merge with new migration logic. * Set correct post terms for wp_template content * updated comment --------- Co-authored-by: Mike Jolley * Update ZIP file * Update testing notes * Update testing notes * Update testing notes * Update testing notes * Update woocommerce.zip file * Revert "Fix: sync_endpoint_with_page should use a matching slug if it exists instead of creating a new page (#10640)" This reverts commit c68583b67ceb59555c932540bdaaa38b464a2565. * Update testing notes * Update ZIP file * Update changelog * Empty commit for release pull request * Add changelog to readme.txt * Update plugin version in several files * Revert dequeue add-to-cart-variation script which is needed to properly handle variable products in single product page (#10723) * Add the testing notes for 10.9.3 * Update 1093.md * Fix md lint error --------- Co-authored-by: github-actions Co-authored-by: Alba Rincón Co-authored-by: Manish Menaria Co-authored-by: Luigi Co-authored-by: Niels Lange Co-authored-by: Tom Cafferkey Co-authored-by: Karol Manijak <20098064+kmanijak@users.noreply.github.com> Co-authored-by: Mike Jolley Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> Co-authored-by: Alexandre Lara --- .../blocks/product-elements/button/style.scss | 1 + composer.json | 2 +- .../testing/releases/1092.md | 74 ++++++++ .../testing/releases/1093.md | 33 ++++ .../testing/releases/README.md | 2 + package-lock.json | 4 +- package.json | 2 +- readme.txt | 17 +- src/BlockTemplatesController.php | 115 +----------- src/BlockTypes/ProductButton.php | 1 - src/Domain/Bootstrap.php | 8 + src/Package.php | 2 +- src/Templates/CartTemplate.php | 7 + src/Templates/CheckoutTemplate.php | 7 + src/Utils/BlockTemplateMigrationUtils.php | 177 ++++++++++++++++++ woocommerce-gutenberg-products-block.php | 34 +--- 16 files changed, 340 insertions(+), 146 deletions(-) create mode 100644 docs/internal-developers/testing/releases/1092.md create mode 100644 docs/internal-developers/testing/releases/1093.md create mode 100644 src/Utils/BlockTemplateMigrationUtils.php diff --git a/assets/js/atomic/blocks/product-elements/button/style.scss b/assets/js/atomic/blocks/product-elements/button/style.scss index 6bcdaaf834d..4df68af32ab 100644 --- a/assets/js/atomic/blocks/product-elements/button/style.scss +++ b/assets/js/atomic/blocks/product-elements/button/style.scss @@ -3,6 +3,7 @@ white-space: normal; display: flex; justify-content: center; + flex-direction: column; align-items: center; gap: $gap-small; diff --git a/composer.json b/composer.json index f2d80363ade..41adf0c7833 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "WooCommerce blocks for the Gutenberg editor.", "homepage": "https://woocommerce.com/", "type": "wordpress-plugin", - "version": "10.9.1", + "version": "10.9.3", "keywords": [ "gutenberg", "woocommerce", diff --git a/docs/internal-developers/testing/releases/1092.md b/docs/internal-developers/testing/releases/1092.md new file mode 100644 index 00000000000..82af63c573f --- /dev/null +++ b/docs/internal-developers/testing/releases/1092.md @@ -0,0 +1,74 @@ +# Testing notes and ZIP for release 10.9.2 + +Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/12397992/woocommerce-gutenberg-products-block.zip) + +## WooCommerce Core + +### Bug Fixes + +#### Load Interactivity API in `bootstrap.php`. [#10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657) + +> **Note** +> Ignore the first step if testing in WooCommerce Core. + +1. Install this custom build of WooCommerce that includes this patch: [woocommerce.zip](https://github.com/woocommerce/woocommerce-blocks/files/12397185/woocommerce.zip). +2. Make sure that `WooCommerce Blocks` plugin is not active. +3. Open the Site Editor and ensure that you are using the blockified template on the Product Catalog template. +4. Visit the `/shop` page and ensure that the Product Button(Add to Cart) works as expected. + +#### Make View Cart link displayed below the Add to Cart button. [#10675](https://github.com/woocommerce/woocommerce-blocks/pull/10675) + +1. Edit Product Catalog template +2. Add Products (Beta) block if it's not there already +3. Save and go to frontend +4. Add a simple product to cart +5. Expected: "View Cart" link appears BELOW the Add to Cart button + + + + + + +
Before: +

+image +
After: +

+image +
+ +## Should be tested by the development team exclusively + +### Bug Fixes + +#### Fix: Made migration migrate block templates in the current theme. [#10641](https://github.com/woocommerce/woocommerce-blocks/pull/10641) + +1. Install a theme that uses block templates. In my case I used FotaWP. +2. Go to Appearance > Edit > Templates and reset the cart/checkout templates to default. +3. Delete has_migrated_cart and has_migrated_checkout options from your options database. +4. View a page on the store. +5. Confirm by viewing the cart and checkout pages that they inherited the block template from the theme. In this case for instance, instead of the default distraction free template we had, you'll see something like this: + +![Screenshot 2023-08-17 at 12 55 00](https://github.com/woocommerce/woocommerce-blocks/assets/90977/bf55ff6c-e8f7-440e-99ed-ec1e676a988b) + +#### Fix/10530 Inconsistent new install behaviour for templates when using block themes. [#10608](https://github.com/woocommerce/woocommerce-blocks/pull/10608) + +1. Get a new env ready to install WP/WC using WP-CLI. You can use this [quick docker setup](https://github.com/woocommerce/woocommerce-blocks/files/12394720/new-test-env.zip) +2. Alias or copy this branch, built ready to use as a plugin into the env +3. Using WP-CLI set up WC using the following command sequence (alter args to suit your case) + +```sh +wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=db --force +wp core install --url=http://localhost --title='WP Staging' --admin_user=admin --admin_password=pass --admin_email=admin@wp.loc +wp option set blog_public 0 +wp plugin activate woocommerce-blocks +wp plugin install woocommerce --version=6.0.0 +wp plugin activate woocommerce +wp plugin install wordpress-importer --activate +wp import ./wp-content/plugins/woocommerce/sample-data/sample_products.xml --authors=skip +wp plugin update woocommerce +``` + +4. Visit the store for the first time, head to Appearance > Editor > Templates > Manage all templates verify that Cart and Checkout have customizations saved +5. Open each one and verify they contain the shortcode version +6. Test the complete checkout flow. diff --git a/docs/internal-developers/testing/releases/1093.md b/docs/internal-developers/testing/releases/1093.md new file mode 100644 index 00000000000..ffbb6d28f12 --- /dev/null +++ b/docs/internal-developers/testing/releases/1093.md @@ -0,0 +1,33 @@ +# Testing notes and ZIP for release 10.9.3 + +Zip file for testing: [woocommerce-gutenberg-products-block.zip](https://github.com/woocommerce/woocommerce-blocks/files/12432284/woocommerce-gutenberg-products-block.zip) + +## WooCommerce Core + +### Bug Fixes + +#### Add to Cart: fix the problem that variable products couldn't be added to cart [#10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657) + +1. Make sure you're using blockified Single Product template +2. Go to frontend +3. Go to product page for variable product (e.g. Hoodie when using sample products) +4. Choose Color and With Logo +5. Make sure Price appears when you chose the options +6. Add the product to Cart +7. Make sure product is added to cart correctly and there's no error + +##### Before + + + +##### After + + + + + + + + + + diff --git a/docs/internal-developers/testing/releases/README.md b/docs/internal-developers/testing/releases/README.md index cd786f6e977..d55d10b298f 100644 --- a/docs/internal-developers/testing/releases/README.md +++ b/docs/internal-developers/testing/releases/README.md @@ -171,6 +171,8 @@ Every release includes specific testing instructions for new features and bug fi - [10.8.3](./1083.md) - [10.9.0](./1090.md) - [10.9.1](./1091.md) + - [10.9.2](./1092.md) + - [10.9.3](./1093.md) diff --git a/package-lock.json b/package-lock.json index a4e65622393..7fec363dad6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@woocommerce/block-library", - "version": "10.9.1", + "version": "10.9.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@woocommerce/block-library", - "version": "10.9.1", + "version": "10.9.3", "hasInstallScript": true, "license": "GPL-3.0+", "dependencies": { diff --git a/package.json b/package.json index 35d1d15a5e5..a3fb475cf49 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@woocommerce/block-library", "title": "WooCommerce Blocks", "author": "Automattic", - "version": "10.9.1", + "version": "10.9.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 eacfeefceed..28fa0709818 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: gutenberg, woocommerce, woo commerce, products, blocks, woocommerce blocks Requires at least: 6.3 Tested up to: 6.3 Requires PHP: 7.3 -Stable tag: 10.9.1 +Stable tag: 10.9.3 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -81,6 +81,21 @@ Release and roadmap notes available on the [WooCommerce Developers Blog](https:/ == Changelog == += 10.9.3 - 2023-08-24 = + +#### Bug Fixes + +- Add to Cart: fix the problem that variable products couldn't be added to cart + += 10.9.2 - 2023-08-21 = + +#### Bug Fixes + +- Load Interactivity API in `bootstrap.php`. ([10657](https://github.com/woocommerce/woocommerce-blocks/pull/10657)) +- Add to Cart button: fix the layout of View Cart link showing after adding product to cart. ([10675](https://github.com/woocommerce/woocommerce-blocks/pull/10675)) +- Fixed checkout and cart page migration routine for users of block themes so that block templates are also migrated. ([10641](https://github.com/woocommerce/woocommerce-blocks/pull/10641)) +- Fixed a bug causing Cart and Checkout Blocks to be used by default instead of shortcode versions on WC updates. ([10608](https://github.com/woocommerce/woocommerce-blocks/pull/10608)) + = 10.9.1 - 2023-08-17 = #### Enhancements diff --git a/src/BlockTemplatesController.php b/src/BlockTemplatesController.php index 2d717697bd8..18d62302e8c 100644 --- a/src/BlockTemplatesController.php +++ b/src/BlockTemplatesController.php @@ -1,6 +1,7 @@ has_migrated_page( 'cart' ) ) { - $this->migrate_page( 'cart', CartTemplate::get_placeholder_page() ); - } - if ( ! $this->has_migrated_page( 'checkout' ) ) { - $this->migrate_page( 'checkout', CheckoutTemplate::get_placeholder_page() ); - } - } - - /** - * Check if a page has been migrated to a template. - * - * @param string $page_id Page ID. - * @return boolean - */ - protected function has_migrated_page( $page_id ) { - return (bool) get_option( 'has_migrated_' . $page_id, false ); - } - - /** - * Prepare default page template. - * - * @param \WP_Post $page Page object. - * @return string - */ - protected function get_default_migrate_page_template( $page ) { - $default_template_content = $this->get_block_template_part( 'header' ); - $default_template_content .= ' - -
- -

' . wp_kses_post( $page->post_title ) . '

- - ' . wp_kses_post( $page->post_content ) . ' -
- - '; - $default_template_content .= $this->get_block_template_part( 'footer' ); - - return $default_template_content; - } - - /** - * Migrates a page to a template if needed. - * - * @param string $page_id Page ID. - * @param \WP_Post $page Page object. - */ - protected function migrate_page( $page_id, $page ) { - if ( ! $page || empty( $page->post_content ) ) { - update_option( 'has_migrated_' . $page_id, '1' ); + // Migration should occur on a normal request to ensure every requirement is met. + // We are postponing it if WP is in maintenance mode, installing, WC installing or if the request is part of a WP-CLI command. + if ( wp_is_maintenance_mode() || ! get_option( 'woocommerce_db_version', false ) || Constants::is_defined( 'WP_SETUP_CONFIG' ) || Constants::is_defined( 'WC_INSTALLING' ) || Constants::is_defined( 'WP_CLI' ) ) { return; } - // Use the page template if it exists, which we'll use over our default template if found. - $existing_page_template = BlockTemplateUtils::get_block_template( get_stylesheet() . '//page', 'wp_template' ); - - if ( $existing_page_template && ! empty( $existing_page_template->content ) && strstr( $existing_page_template->content, 'wp:post-content' ) ) { - // Massage the original content into something we can use. Replace post content with a group block. - $pattern = '/()/'; - $replacement = ' - -
' . wp_kses_post( $page->post_content ) . '
- - '; - $template_content = preg_replace( $pattern, $replacement, $existing_page_template->content ); - } else { - $template_content = $this->get_default_migrate_page_template( $page ); - } - - $new_page_template = BlockTemplateUtils::get_block_template( 'woocommerce/woocommerce//' . $page_id, 'wp_template' ); - - // Check template validity--template must exist, and custom template must not be present already. - if ( ! $new_page_template || $new_page_template->wp_id ) { - update_option( 'has_migrated_' . $page_id, '1' ); - return; + if ( ! BlockTemplateMigrationUtils::has_migrated_page( 'cart' ) ) { + BlockTemplateMigrationUtils::migrate_page( 'cart', CartTemplate::get_placeholder_page() ); } - - $new_page_template_id = wp_insert_post( - [ - 'post_name' => $new_page_template->slug, - 'post_type' => 'wp_template', - 'post_status' => 'publish', - 'tax_input' => array( - 'wp_theme' => $new_page_template->theme, - ), - 'meta_input' => array( - 'origin' => $new_page_template->source, - ), - 'post_content' => $template_content, - ], - true - ); - - if ( ! is_wp_error( $new_page_template_id ) ) { - update_option( 'has_migrated_' . $page_id, '1' ); - } - } - - /** - * Returns the requested template part. - * - * @param string $part The part to return. - * - * @return string - */ - protected function get_block_template_part( $part ) { - $template_part = BlockTemplateUtils::get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' ); - if ( ! $template_part || empty( $template_part->content ) ) { - return ''; + if ( ! BlockTemplateMigrationUtils::has_migrated_page( 'checkout' ) ) { + BlockTemplateMigrationUtils::migrate_page( 'checkout', CheckoutTemplate::get_placeholder_page() ); } - return $template_part->content; } /** diff --git a/src/BlockTypes/ProductButton.php b/src/BlockTypes/ProductButton.php index 6bd773a5912..16a5123938e 100644 --- a/src/BlockTypes/ProductButton.php +++ b/src/BlockTypes/ProductButton.php @@ -61,7 +61,6 @@ protected function enqueue_assets( array $attributes ) { */ public function dequeue_add_to_cart_scripts() { wp_dequeue_script( 'wc-add-to-cart' ); - wp_dequeue_script( 'wc-add-to-cart-variation' ); } /** diff --git a/src/Domain/Bootstrap.php b/src/Domain/Bootstrap.php index 09b7efd9fc4..9448126ab1a 100644 --- a/src/Domain/Bootstrap.php +++ b/src/Domain/Bootstrap.php @@ -100,6 +100,7 @@ public function __construct( Container $container ) { protected function init() { $this->register_dependencies(); $this->register_payment_methods(); + $this->load_interactivity_api(); // This is just a temporary solution to make sure the migrations are run. We have to refactor this. More details: https://github.com/woocommerce/woocommerce-blocks/issues/10196. if ( $this->package->get_version() !== $this->package->get_version_stored_on_db() ) { @@ -225,6 +226,13 @@ function() { ); } + /** + * Load and set up the Interactivity API if enabled. + */ + protected function load_interactivity_api() { + require_once __DIR__ . '/../Interactivity/load.php'; + } + /** * Register core dependencies with the container. */ diff --git a/src/Package.php b/src/Package.php index 2b915f4390b..49718851b62 100644 --- a/src/Package.php +++ b/src/Package.php @@ -109,7 +109,7 @@ public static function container( $reset = false ) { NewPackage::class, function ( $container ) { // leave for automated version bumping. - $version = '10.9.1'; + $version = '10.9.3'; return new NewPackage( $version, dirname( __DIR__ ), diff --git a/src/Templates/CartTemplate.php b/src/Templates/CartTemplate.php index ed126951543..c677838afc6 100644 --- a/src/Templates/CartTemplate.php +++ b/src/Templates/CartTemplate.php @@ -1,6 +1,8 @@ get_placeholder_page(); return null !== $placeholder && $post instanceof \WP_Post && $placeholder->post_name === $post->post_name; diff --git a/src/Templates/CheckoutTemplate.php b/src/Templates/CheckoutTemplate.php index 000c6edbe18..02ac2a7420b 100644 --- a/src/Templates/CheckoutTemplate.php +++ b/src/Templates/CheckoutTemplate.php @@ -1,6 +1,8 @@ get_placeholder_page(); return null !== $placeholder && $post instanceof \WP_Post && $placeholder->post_name === $post->post_name; diff --git a/src/Utils/BlockTemplateMigrationUtils.php b/src/Utils/BlockTemplateMigrationUtils.php new file mode 100644 index 00000000000..d87f042ede9 --- /dev/null +++ b/src/Utils/BlockTemplateMigrationUtils.php @@ -0,0 +1,177 @@ +wp_id ) { + return self::set_has_migrated_page( $template_slug, 'custom-template-exists' ); + } + + // Use the page template if it exists, which we'll use over our default template if found. + $page_template = self::get_page_template( $page ); + $default_template = self::get_default_template( $page ); + $template_content = $page_template ?: $default_template; + + // If at this point we have no content to migrate, bail. + if ( ! $template_content ) { + return self::set_has_migrated_page( $template_slug, 'no-content' ); + } + + if ( self::create_custom_template( $block_template, $template_content ) ) { + return self::set_has_migrated_page( $template_slug ); + } + } + + /** + * Get template for a page following the page hierarchy. + * + * @param \WP_Post|null $page Page object. + * @return string + */ + protected static function get_page_template( $page ) { + $templates = array(); + + if ( $page && $page->ID ) { + $template = get_page_template_slug( $page->ID ); + + if ( $template && 0 === validate_file( $template ) ) { + $templates[] = $template; + } + + $pagename = $page->post_name; + + if ( $pagename ) { + $pagename_decoded = urldecode( $pagename ); + if ( $pagename_decoded !== $pagename ) { + $templates[] = "page-{$pagename_decoded}"; + } + $templates[] = "page-{$pagename}"; + } + } + + $block_template = false; + + foreach ( $templates as $template ) { + $block_template = BlockTemplateUtils::get_block_template( get_stylesheet() . '//' . $template, 'wp_template' ); + + if ( $block_template && ! empty( $block_template->content ) ) { + break; + } + } + + return $block_template ? $block_template->content : ''; + } + + /** + * Prepare default page template. + * + * @param \WP_Post $page Page object. + * @return string + */ + protected static function get_default_template( $page ) { + if ( ! $page || empty( $page->post_content ) ) { + return ''; + } + $default_template_content = ' + +
+ +

' . wp_kses_post( $page->post_title ) . '

+ + ' . wp_kses_post( $page->post_content ) . ' +
+ + '; + return self::get_block_template_part( 'header' ) . $default_template_content . self::get_block_template_part( 'footer' ); + } + + /** + * Create a custom template with given content. + * + * @param \WP_Block_Template|null $template Template object. + * @param string $content Template content. + * @return boolean Success. + */ + protected static function create_custom_template( $template, $content ) { + + $term = get_term_by( 'slug', $template->theme, 'wp_theme', ARRAY_A ); + + if ( ! $term ) { + $term = wp_insert_term( $template->theme, 'wp_theme' ); + } + + $template_id = wp_insert_post( + [ + 'post_name' => $template->slug, + 'post_type' => 'wp_template', + 'post_status' => 'publish', + 'tax_input' => array( + 'wp_theme' => $template->theme, + ), + 'meta_input' => array( + 'origin' => $template->source, + ), + 'post_content' => $content, + ], + true + ); + + wp_set_post_terms( $template_id, array( $term['term_id'] ), 'wp_theme' ); + + return $template_id && ! is_wp_error( $template_id ); + } + + /** + * Returns the requested template part. + * + * @param string $part The part to return. + * @return string + */ + protected static function get_block_template_part( $part ) { + $template_part = BlockTemplateUtils::get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' ); + if ( ! $template_part || empty( $template_part->content ) ) { + return ''; + } + return $template_part->content; + } +} diff --git a/woocommerce-gutenberg-products-block.php b/woocommerce-gutenberg-products-block.php index d2f05131fb9..86ffa5a465e 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: 10.9.1 + * Version: 10.9.3 * Author: Automattic * Author URI: https://woocommerce.com * Text Domain: woo-gutenberg-products-block @@ -285,35 +285,3 @@ function woocommerce_blocks_plugin_outdated_notice() { } add_action( 'admin_notices', 'woocommerce_blocks_plugin_outdated_notice' ); - -/** - * Disable the Interactivity API if the required `WP_HTML_Tag_Processor` class - * doesn't exist, regardless of whether it was enabled manually. - * - * @param bool $enabled Current filter value. - * @return bool True if _also_ the `WP_HTML_Tag_Processor` class was found. - */ -function woocommerce_blocks_has_wp_html_tag_processor( $enabled ) { - return $enabled && class_exists( 'WP_HTML_Tag_Processor' ); -} -add_filter( - 'woocommerce_blocks_enable_interactivity_api', - 'woocommerce_blocks_has_wp_html_tag_processor', - 999 -); - -/** - * Load and set up the Interactivity API if enabled. - */ -function woocommerce_blocks_interactivity_setup() { - // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment - $is_enabled = apply_filters( - 'woocommerce_blocks_enable_interactivity_api', - true - ); - - if ( $is_enabled ) { - require_once __DIR__ . '/src/Interactivity/load.php'; - } -} -add_action( 'plugins_loaded', 'woocommerce_blocks_interactivity_setup' );