Product Collection block: New JS events and soft deprecation of Product Grid blocks

At the start of the year, we announced a significant update to our product grid system, the Product Collection block. Today, we’re introducing new JavaScript events to the Product Collection block and are on the path to consolidating all product grid functionalities within this single block. This will provide an improved experience by covering all the features of existing product grids, such as “All Products”, “Newest Products”, “On Sale Products”, and more, into the Product Collection block.

To support this, new JS events have been implemented as a replacement for actions previously emitted by other product grid blocks. These changes will become available with the release of WooCommerce 9.4.

Check out our example below on how to migrate to the new event structure, or dive directly into our documentation.

New JavaScript Events:

Starting with WooCommerce 9.4, Product Collection will emit JavaScript events on the frontend:

New JS Events:

WhenJS EventPrevious action
Product Collection is rendered (or re-rendered when changing a page)wc-blocks_product_list_renderedexperimental__woocommerce_blocks-product-list-render
Product is viewedwc-blocks_viewed_productexperimental__woocommerce_blocks-product-view-link
Product is added to cartwc-blocks_added_to_cartexperimental__woocommerce_blocks-cart-add-item

Code Migration Example:

If you previously used the following code with experimental__woocommerce_blocks-product-list-render:

wp.hooks.addAction(
    "experimental__woocommerce_blocks-product-list-render",
    "your-namespace",
    ( {products, listName } ) => {
        /* ... */
    }
);

You should now use:

document.body.addEventListener(
    'wc-blocks_product_list_rendered',
    event => {
        const { collection } = e.detail;
        /* ... */
    }
);

Please note that the new events do not have an exact 1:1 payload match with the previous actions. Refer to the updated documentation for details on the new event structure.

Upcoming Soft Deprecation of Product Grid Blocks:

As part of the ongoing transition, WooCommerce 9.5 will introduce a soft deprecation for specific product grid blocks by hiding them from the block inserter. However, these blocks will continue to function on sites where they’re already in use.

We encourage you to transition to the Product Collection block to take full advantage of its unified features.

Tell us your thoughts

We’re looking forward to your feedback! Use Making Product Collection the main block for product lists and collections #44776 GitHub discussion to discuss extensibility.


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


Leave a Reply

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