Skip to main content

Checkout Page Flow

The checkout page flow is built from TestCheckoutDemo. It combines form-controlled checkout primitives with a read-only order summary that reuses cart item and total atoms.

Flow Structure

CheckoutProvider
CheckoutForm
BillingAddressForm
ShippingAddressForm
ShippingMethodSelector
PaymentMethodSelector
TermsCheckbox
CheckoutNotices
PlaceOrderButton
OrderSummary
Product row slot
CartItemTitle
CartAttributeList
CartItemSubtotal
Totals slot
OrderSummaryTotalsList
TotalsSubtotal
TotalsDiscount
TotalsShipping
TotalsTax
TotalsTotal

CheckoutProvider scopes checkout state for the form and child controls. CheckoutForm owns the submit event and the final Store API checkout request.

Address Forms

BillingAddressForm and ShippingAddressForm share address form props and markup generation. They render fields from the checkout field schema, not from hard-coded field lists in the docs.

The checkout runtime handles:

  • required billing fields,
  • email validation,
  • country and state selectors,
  • state field visibility when the selected country has no state options,
  • the shipping-address toggle and its embedded field group,
  • local blocking before Store API submit when known-invalid fields are present.

E2E verifies country/state refresh and local validation behavior before checkout requests are sent.

Selectors

ShippingMethodSelector and PaymentMethodSelector use the shared UIChoice mode logic. Both support select and button-radio presentation. In checkout, selected values are written into checkout state before the form is submitted.

Shipping method options come from package-aware Store API rates. Payment options come from Store API payment methods. The demo checkout uses select mode for both.

Terms, Notices, And Submit

TermsCheckbox blocks submit when it is required and unchecked. CheckoutNotices renders checkout-scoped error messages. PlaceOrderButton triggers the parent CheckoutForm.

The form sets data-ome-state during validation, pending submit, success, and error states so authors can style the visible state without replacing the native Woo order lifecycle.

Order Summary

OrderSummary is read-only. It renders current cart products and totals inside checkout, but it does not submit or mutate checkout data. The demo uses the full_atoms mode so product rows and totals are authored through slots:

SlotComponents used
productsCartItemTitle, CartAttributeList, CartItemSubtotal.
totalsOrderSummaryTotalsList with subtotal, discount, shipping, tax, and total atoms.

This reuse keeps cart and checkout total display aligned with the same normalized cart data.

Store API And Native Hooks

Checkout submission goes through Woo Store API checkout. Lifecycle E2E verifies native Woo hooks still run through this path, including woocommerce_store_api_checkout_update_order_from_request and woocommerce_rest_checkout_process_payment_with_context.

That means Etch components can be authored visually while Woo plugins that rely on native checkout hooks still see the checkout lifecycle.

E2E Coverage

ScenarioVerified behavior
checkout_successA full checkout form submits a real order.
checkout_validation_errorInvalid required fields are marked locally.
checkout_terms_blockedRequired terms block checkout and render notices.
checkout_terms_successChecked terms allow the normal success flow.
payment_selector_button_radioPayment selector button-radio mode renders and selects values.
payment_selector_selectPayment selector select mode renders trigger/content and selected values.
shipping_selector_selectCheckout-compatible shipping selection works in select mode.
lifecycle_checkoutStore API checkout completes through native Woo lifecycle hooks.