WooCommerce Blocks 5.0.0 Release Notes

There’s a new version of WooCommerce Blocks available! Version 5.0.0 is now available on WordPress.org and GitHub.

This release mostly contains behind the scenes refactors (as we gradually convert the JavaScript code to TypeScript), but also adds support for Batching in the StoreAPI, and fixes a visual bug with customer addresses on the cart page.

Dev Notes

Class Deprecations

Two internal classes (Automattic\WooCommerce\Blocks\Assets and Library) have been deprecated in this release, with functionality being moved to AssetsController and BlockTypesController.

Since these were internal bootstrap classes we don’t anticipate any external usage, but noting that these classes will be removed in a future release of Blocks.

Checkout Event Changes

The Checkout event onCheckoutBeforeProcessing has been renamed to onCheckoutValidationBeforeProcessing to more clearly articulate its coupling to the validation happening when the Checkout form is submitted. 

onCheckoutBeforeProcessing will be deprecated formally in the future.

Shared Settings Deprecation

Blocks offered a filter hook named woocommerce_shared_settings which could be used to change, add, or remove settings that are passed from the server to the client. This is now considered deprecated—a warning will be logged to the browser error console if used.

We recommend instead using the Asset Data Registry directly, so for example:

use Automattic\WooCommerce\Blocks\Package;
use Automattic\WooCommerce\Blocks\Assets\AssetDataRegistry;
Package::container()->get( AssetDataRegistry::class )->add( $key, $value )

Doing this reduces the risk of conflicting or overwriting data, unlike the filter which allowed any setting to be modified leading to unintentional side effects.

Changelog

Enhancements

  • Added support to the Store API for batching requests. This allows multiple POST requests to be made at once to reduce the number of separate requests being made to the API. (4075)

Bug Fixes

  • Prevent parts of old addresses being displayed in the shipping calculator when changing countries. (4038)

Refactor

  • Rename onCheckoutBeforeProcessing to onCheckoutValidationBeforeProcessing.
  • Switched to rest_preload_api_request for API hydration in cart and checkout blocks. (4090)
  • Introduced AssetsController and BlockTypesController classes (which replace Assets.php and Library.php). (4094)
  • Replaced usage of the woocommerce_shared_settings hook. This will be deprecated. (4092)

Keep yourself in the loop!

This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form


5 responses to “WooCommerce Blocks 5.0.0 Release Notes”

  1. […] Blocks 5.1.0: The package update includes 5.0.0 and 5.1.0. Please note that most content included in Blocks updates is not present in WooCommerce […]

  2. […] Blocks 5.1.0: The package update includes 5.0.0 and 5.1.0. Please note that most content included in Blocks updates is not present in WooCommerce […]

  3. […] Blocks 5.1.0: The package update includes 5.0.0 and 5.1.0. Please note that most content included in Blocks updates is not present in WooCommerce […]

  4. […] Blocks 5.1.0: The package update includes 5.0.0 and 5.1.0. Please note that most content included in Blocks updates is not present in WooCommerce […]

Leave a Reply

Your email address will not be published. Required fields are marked *