The latest version of WooCommerce Blocks, version 9.9.0, is now available for download on WordPress.org and GitHub.
Notable Changes
This release includes many exciting changes and bug fixes. Below are a few of the most important ones that we want to highlight to our community.
Fixed a bug where ShippingData
returned by payment processing observers did not contain an address property
In Check for address on shippingData (#8878) which was included in this release, we fixed a regression with our payment processing observers. Previously, certain payment event observers (see the eventRegistration
prop in our documentation) that returned a shippingData
object with an address
property would overwrite the customer’s shipping address with the supplied address, however in #8163 this was inadvertently removed.
This has now been changed so that these extensions work as they did (but passing the address via shippingData.address
is still deprecated, and the preferred method is to pass it via shippingAddress
which should be a flat address object).
Migrating to shippingAddress
To migrate away from the deprecated shippingData
property to using the new shippingAddress
property, you will need to update your observer’s return value. The address, previously stored the in shippingData.address
should be moved into shippingAddress
which will be a flat object containing only the address data.
Old observer response value
return { shippingData: { address: { first_name: 'John', last_name: 'Doe', } }
New observer response value – note the shippingAddress
value is a flat object
return { shippingAddress: { first_name: 'John', last_name: 'Doe', } }
Client-side postcode validation in the Checkout block
In this release, we included a change that performs postcode validation on the client-side. This change improves the performance of the Checkout process for the shopper. Previously the postcode was only validated on the server. There was a delay before the user saw an error if they entered an invalid postcode. This new experience not only reduces the load on your server but allows the shopper to work through the checkout form more quickly!
We still perform server-side validation of the postcode, but this is done when the checkout form is submitted rather than when the value changes.
Pickup location on the order confirmation page
When shoppers check out using a local pickup method, they will now see the pickup location’s address on the order confirmation page and in the order confirmation emails! The collection instructions also appear in this area.
Payment gateway filtering in Store API
Payment methods on the Checkout block will now respect the woocommerce_available_payment_gateways
filter. For example, on the PHP side you could prevent a payment method being shown to a customer using:
add_filter( 'woocommerce_available_payment_gateways', function( $payments ) { unset( $payments['cod'] ); return $payments; } );
As part of this work, the Store APIs wc/store/v1/cart
route will now return a list of available payment methods for that cart, e.g.:
"payment_methods": [ "cod", "bacs", "cheque" ],
This is in turn stored on the JavaScript side in the wc/store/cart
data store. This change does not affect payment extensions or payment method registration, it only affects use of filters on the server side.
Add to Cart button styling improvements
We have made some improvements to the Add to cart button, providing greater customization options for online stores. It’s now possible to choose between Fill and Outline styles for the button and adjust its width to 25%, 50%, 75%, or 100% of the parent container. In addition, we’ve introduced a variety of typography controls, including Font Family, Appearance, Line height, Letter spacing, Decoration, and Letter case.
These improvements aim to provide greater control over the look and feel of the Add to cart button, ensuring it seamlessly integrates with the store’s design.
Mini Cart Block Improvements
It’s now possible to customize all buttons of the Mini Cart, including changing their color and background as well as changing the style from outline to filled. In addition to that, the Mini Cart block got a new setting to customize how it renders in the Cart and Checkout pages (Hide or Remove), which will allow to change its behavior depending on the desired header style.
Provide a way to switch to the blockified Single Product Template
We have added a button “Upgrade to Blockified Single Product template” to the Single Product template. By clicking on this button, the classic template is upgraded to the new Blockified Single Product template.
This new template allows customizations of the product page with blocks, giving more flexibility and creativity in showcasing the products.
Changelog
Enhancements
- Move Related Products’s notice component to the Inspector Control section. (8843)
- Product SKU Block: Don’t render the prefix when the SKU isn’t defined. (8837)
- Mini-cart: Add the option to change the style between ‘Outline’ and ‘Fill’ in all the buttons. (8835)
- Product SKU: Make the block focusable in editor. (8804)
- Add Fill & Outline styles, width settings & new typography controls for Product(Add to cart) button block. (8781)
- Allow themes to remove the Mini Cart title on overridden template parts. (8779)
- Add style to the
Mini Cart
buttons. (8776) - Add the ability to change the background and text colors of the Mini Cart block “Start shopping” button. (8766)
- Mini-cart: Add setting to not render the block on the cart & checkout pages. (8700)
- Ensure shipping rates do not show in the Checkout block if the “Hide shipping costs until an address is entered option is selected”. (8682)
- Move option to hide shipping costs until an address is entered to the Checkout block. (8680)
- Remove certain Shipping settings from WooCommerce -> Settings -> Shipping -> Shipping Options when using the Cart or Checkout blocks, these have been moved to setting on the blocks. (8679)
- Add spacing between Mini Cart title and products list when scrolled. (8676)
- Add new ExperimentalOrderLocalPickupPackages Slot/Fill. (8636)
- Add default Single Product HTML template. (8515)
- Validate postcodes client-site instead of server-side. (8503)
- Added support for
woocommerce_available_payment_gateways
to the Store API. (8441)
Bug Fixes
- Fix border styles not visible in the editor in Featured Product and Featured Category blocks. (8838)
- Add decoding to product names titles that are in HTML entities. (8824)
- Fix react 18 error in the editor when using cart/checkout blocks. (8820)
- Filter by Stock and Filter by Rating: Fix the potential endless redirection loop when used on a search results page. (8784)
- Fix “Save changes” default behavior bug in the Firefox browser. (8754)
- Store API – Apply
woocommerce_cart_item_permalink
filter to cart item permalinks. (8726) - Add validation error to prevent checkout when there is no shipping method available. (8384)
- Fix Markdown table in payment-method-integration.md > external contribution #8158. (8258)
Leave a Reply