Contents (3)
WooCommerce’s block Cart and Checkout run on the Store API, not on PHP templates. Hooks such as woocommerce_review_order_before_payment don’t fire on these pages.
Register extra data on the cart endpoint
woocommerce_store_api_register_endpoint_data( [
'endpoint' => \Automattic\WooCommerce\StoreApi\Schemas\V1\CartSchema::IDENTIFIER,
'namespace' => 'hamidarab-delivery',
'data_callback' => static fn () => [ 'window' => get_delivery_window() ],
'schema_callback' => static fn () => [
'window' => [ 'type' => 'string', 'readonly' => true ],
],
'schema_type' => ARRAY_A,
] );
The data appears in the Store API response under extensions.hamidarab-delivery and is available on the JavaScript side.
Show it in the UI
Use Slot/Fill or an inner Checkout block to render it; jQuery DOM manipulation on these pages is fragile.
Before migrating to the block Checkout, list every existing checkout customisation so nothing is lost.
What to test
- Inspect the
/wp-json/wc/store/v1/cartresponse directly. - Test guest and logged-in customers separately.
- Check behaviour behind page cache and CDN; the Store API must never be cached.
$ ./request_review
Facing the same problem in your own store?
Senior WordPress and WooCommerce backend engineering for complex production problems.
Request a Technical Assessment
## Comments