WooCommerce Blocks 4.0 Release Notes

A new version of WooCommerce Blocks has been released! Version 4.0.0 is now available for download from GitHub and WordPress.org.

This release includes some fixes for the Cart and Checkout blocks, and the Store API which powers them. Thanks again to all of you who are using the new blocks and reporting things you’d like improved!

We’re actively working on addressing issues and also integrating more extensions; some of the more technical changes in this release are there to support these efforts.

Changes to Order Processing within the Checkout Block

Some of the largest changes in this release are behind the scenes in the Store API. We made some changes so that the order in which data is processed on the checkout endpoint is done in a more logical order, so that orders are not left with the wrong state if Checkout is aborted.

The new order of events is as follows:

  1. Obtain Draft Order
  2. Process Request
  3. Process Customer
  4. Validate Order
  5. Process Payment

Whilst these changes should not impact developers, they should make our Checkout endpoint more robust. For example, if an item is out of stock, a pending order will no longer be created.

User Creation During Checkout

Along the same lines as the issue above, we found some flaws in the customer creation logic during Checkout, specifically with the security “nonce”. When a user is logged in, these change, which would mean follow up API requests would fail with an error.

To resolve this, we now return an updated nonce along with the error response, and ensure that when a customer account is created, the Checkout state is updated to reflect this (for example, the create account checkbox is hidden).

Changelog

Enhancements

  • Dev: Change register_endpoint_data to use an array of params instead of individual params. (3478)
  • Dev: Expose store/cart via ExtendRestApi to extensions. (3445)
  • Dev: Added formatting classes to the Store API for extensions to consume.

Bug Fixes

  • Checkout Block: Prevent Create an account from creating up a user account if the order fails coupon validation. (3423)
  • Make sure cart is initialized before the CartItems route is used in the Store API. (3488)
  • Fix notice close button color in Twenty Twenty One dark mode. (3472)
  • Remove held stock for a draft order if an item is removed from the cart. (3468)
  • Ensure correct alignment of Checkout notice’s dismiss button. (3455)
  • Fixed a bug in Checkout Block (Store API) causing Checkout to fail when using an invalid coupon and creating an account.
  • Checkout Block: Correctly handle cases where the order fails with an error (e.g. invalid coupon) and a new user account is created. (3429)
  • Dev: Refactored and reordered Store API Checkout processing to handle various edge cases and better support future extensibility. (3454)

Keep yourself in the loop!

Sign up for the WooCommerce developer newsletter:
Hidden
Hidden
Hidden


2 responses to “WooCommerce Blocks 4.0 Release Notes”

  1. I’d love to use them but until third party integrations are supported in the checkout and cart blocks I can’t. Any idea when that will be?

    1. We’re working on adding support in our own extensions now. Are there specific extensions that you’re looking for support from? It will be up to the individual developers of different extensions to choose to support the blocks (although we firmly believe that this is the direction that Woo is moving, so all developers should be looking towards supporting them).

Leave a Reply

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