Customizing WooCommerce Cart Layout with the New Block-Based System

In a recent Business Bloomer Club Slack thread, a WooCommerce developer raised an important question about the recent shift to block-based cart and checkout pages in WooCommerce 8.3.

With this update, WooCommerce now defaults to using blocks instead of the traditional cart.php file, affecting how developers customize the cart page with hooks and filters.

This transition has raised challenges for many, as the familiar filters and hooks now behave differently with block-based pages.

Understanding the Block-Based Cart and Checkout in WooCommerce 8.3

With the 8.3 update, WooCommerce now uses blocks as the default structure for the cart and checkout pages. This change is part of WooCommerce’s broader move to modernize its user experience and improve site speed and functionality, though it has impacted traditional methods for customizing these pages.

If you’re working with a new WooCommerce installation, you may notice that customizations intended for cart.php no longer apply to these block-based pages. You can read more about this update in WooCommerce’s FAQ on Cart and Checkout Blocks.

Options for Restoring Custom Cart Layouts

For now, there are two primary ways to regain control over the cart layout:

Use the [woocommerce_cart] Shortcode

One approach is to replace the cart block with the [woocommerce_cart] shortcode on the Cart page. This restores the traditional layout that still relies on the cart.php file, allowing you to use your established filters and hooks.

Customize Blocks with Custom Code or JavaScript

If you prefer to work with the block-based setup, consider using WooCommerce’s custom code options or JavaScript to add specific filters. Keep in mind that this method requires familiarity with JavaScript and WooCommerce block development.

Conclusion

While WooCommerce’s block-based cart provides exciting potential, it may disrupt existing layouts and customizations. The shortcode method offers an immediate solution for those who rely on traditional hooks and filters, while a deeper dive into WooCommerce’s block settings can offer a more future-proofed approach.

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Reply

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