WIACPSite theme 0.2.0-alpha.92
Türkçe

§5.13

Order flow without page reloads, badge and billing profile

  • Phase 11.4
  • theme 1.14.0
  • Flow region: header.wcp writes <div id="wi-flow" data-flow-root …><!--wi-flow--> inside <main>, footer.wcp writes <!--/wi-flow--></div>. For a request with the X-WIACP-Flow: 1 header the core returns the part between these two markers as JSON. Without the markers the browser opens the full page (older themes are unaffected). A page container that joins the flow carries data-flow-scope and data-flow-stage; forms in that scope and a[data-flow-link] links are submitted by theme.js. A theme script must listen for the wi:flow:load event and bind again when the region changes.
  • Shared data: $cart_badge {count, label} — only this visitor's cart line count (domains included) and an accessible label. When the count is 0 the badge is hidden; aria-label uses the label. The key is cart_badge, not cart, so it does not clash with page data.
  • Stages: $stages / in checkout $steps [{key configure / addons / profile / summary / payment, number, label, current, done, url}]; the default theme draws them with includes/stages.wcp.
  • configureproduct.wcp: $state['panel'] (1, 2 or 0 = both), $state['panels']; hidden panel field and action=next|back buttons. Fields in a hidden panel are submitted too (view only).
  • cart.wcp: $groups {product, domain} and kind per line; domains are a separate section.
  • checkout.wcp: $step preview / profile / review; $profile {cards[…, selected, complete, edit_url, can_reveal], select_action, reveal_action, account_open, can_add, new_open, new_form_html, edit, manage_url}; $review['coupon'] {code, applied, error, discount, action} — the coupon form is not inside the confirmation form but a separate form linked with the form="…" attribute. ID / tax numbers arrive masked only; from 1.22.0 on, showing them in full takes the client's password and lasts 5 minutes (§5.21).
  • ordercomplete.wcp: $proforma {number, issued, due_date, items[description, sub, quantity, amount], subtotal, discount, taxes, total, billing}; $stages.
  • Mobile bar: includes/flow-bar.wcp (≤ 991 px; env(safe-area-inset-bottom); hidden while the keyboard is open; when the data-bar-form form is invalid the button is aria-disabled). The amount is only the server's formatted text.
  • There is no guest step ($guest and guest_blocked on a line are constant false for older themes).
  • Profile stage declaration: a theme that draws stage 3 (billing profile) declares 'supports' => [..., 'checkout_profiles'] in the manifest. A theme that does not (for example a custom theme based on 1.13.0) works with the 11.3 flow: a visitor who is not signed in is sent to the login page; if the account is complete, the account details are selected as the profile and the review step opens directly; if incomplete (or with ?adim=bilgiler), $step = 'details' arrives with $details['form_html'] (account billing form). Additional billing profiles are managed only in My account › Billing profiles.