Moving from shortcodes to cart and checkout blocks on WooCommerce
Since WooCommerce 8.3, released on 14 November 2023, the Cart and Checkout pages use Gutenberg blocks by default on new installs, replacing the historic [woocommerce_cart] and [woocommerce_checkout] shortcodes. Shortcodes remain supported as a fallback: there’s no rush to migrate.
What blocks change compared with shortcodes
The [woocommerce_cart] and [woocommerce_checkout] shortcodes generate the checkout flow in server-side PHP, with a classic HTML render. Cart and checkout blocks work differently: the interface relies on React in the browser, talking to the site through the WooCommerce Store API rather than a full page reload at each step. The visual result for the buyer is still a standard checkout flow, but the underlying technical mechanism changes entirely.
You can switch back to the shortcode at any time via the transform button available in the block’s toolbar, which leaves room to manoeuvre if an extension is blocking the migration.
Why a checkout customisation might stop applying
- A classic PHP hook or filter that changed the display of the shortcode cart or checkout (adding a field, a message, or reordering sections, for example) doesn’t apply automatically to blocks: the React architecture doesn’t run that PHP code at render time, so a rewrite is often needed through the block-specific extension points (JavaScript filters, Store API).
- A payment or shipping extension that doesn’t explicitly declare block compatibility may not show up as an available payment method on the block cart or checkout, even though it works normally with shortcodes.
- A theme that heavily overrode the CSS or PHP templates of the shortcode checkout (files under woocommerce/checkout/) will see those customisations have no effect on blocks, which use their own templates.
How I run the switch to blocks
-
Identifying the site’s current mode
I check whether the Cart and Checkout pages still use the historic shortcodes or already use blocks, especially on a site created before November 2023 that didn’t switch automatically.
-
Testing the relevant extensions before switching
I check on a test environment that every active payment and shipping extension works with blocks and declares its compatibility, before any production switch.
-
Listing existing customisations
I list the PHP hooks and template overrides that change the shortcode checkout, to identify which ones need rewriting for blocks.
-
Switching over and targeted rewriting
I enable the blocks and rewrite only the customisations that no longer apply, using the block-specific extension points rather than reproducing the old mechanism.
-
Fallback if something blocks the migration
If a critical extension isn’t compatible, I convert the affected block back to shortcode via the toolbar, which lets me postpone that page’s migration without blocking the rest of the site.
Going further
-
Migrating WooCommerce to high-performance order storage
A change from the same period of WooCommerce, with its own compatibility logic on the extensions side.
-
Fixing a WooCommerce payment issue
If a payment extension stops showing up after switching to blocks, this is usually where I start diagnosing.
-
Updating WooCommerce to a major version
Cart and checkout blocks are one of the changes to check before a major WooCommerce version upgrade.
-
WordPress and WooCommerce migration hub
Every migration and version upgrade I handle on WordPress and WooCommerce.
Describe your need in one minute
A few targeted questions so I can reply with an estimate rather than another questionnaire.