WooCommerce Blocks 8.8.0 Release Notes

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

Filter by Rating block

This release contains a new block: the Filter by Rating block. This allows shoppers to select a rating and only show products that satisfy the filter’s criteria.

The Filter by Rating block being used to show products rated 3-stars.

New hook for modifying cart_item_data

We added a new hook to the Store API named woocommerce_store_api_add_to_cart_data that provides an array of cart item data, and the API request object. This allows data to be modified or added to cart items before they are added to the cart.

For example, if an extension were to pass custom data to the API endpoint, it could retrieve the posted values via the new hook and then store it within the cart item itself for later use:

add_filter( 'woocommerce_store_api_add_to_cart_data', function( $add_to_cart_data, \WP_REST_Request $request ) {
     $add_to_cart_data['cart_item_data']['custom'] = sanitize_text_field( $request['custom-extension-data'] );
     return $add_to_cart_data;
}, 10, 2 );

More information about this can be found on the pull request in the WooCommerce Blocks GitHub repository.

Other changes

Besides these changes, we also made some performance improvements in the editor when working with the Cart and Checkout blocks. We added a notice to the block inspector to let users know these blocks are a beta feature, but the implementation of this notice had a slight performance impact. To fix this, we added some extra checks which allow us to stop executing the code for this notice early if the editor was not focused on either the Cart or Checkout block.

This release also fixes some alignment issues with the mini-cart in the editor.

We also fixed a bug where object data would be lost or inconsistent when using the /cart/extensions endpoint.

Finally, we fixed a bug where a fatal error would sometimes occur when using certain shipping setups on specific store configurations.

Changelog

Enhancements

  • Filter by Ratings: Add the Filter by Rating block to the feature plugin build. (7384)
  • Filter by Ratings: Improve accessibility by announcing the rating filter change. (7370)
  • Prevent resource hinting when cart/checkout blocks are not in use. (7364)
  • Separate filter title and filter controls by converting the Rating filter block to use Inner Blocks. (7362)
  • Products by Rating: Add support for Display Options. (7311)
  • Store API: Introduced woocommerce_store_api_add_to_cart_data hook. (7252)

Bug Fixes

  • Fix performance issue with the sidebar notices. (7435)
  • Fix mini cart items alignment issues in Editor. (7387)
  • Store API: Replaced wc()->api->get_endpoint_data usage in /cart/extensions to fix inconsistencies via filter hooks. (7361)
  • Fixes a fatal error with Cart Block usage in specific site configurations with multiple shipping countries. (6896)

Keep yourself in the loop!

Sign up for the WooCommerce developer newsletter:
Hidden
Hidden
Hidden


Leave a Reply

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