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:
- Obtain Draft Order
- Process Request
- Process Customer
- Validate Order
- 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).
- 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.
- Checkout Block: Prevent
Create an accountfrom 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)