Where data lives
What CBP stores in the browser versus on the Shopify order.
Where data lives
🛠 Dev (👤 Ops: useful background)
CBP keeps small amounts of state so the customer's vehicle and postcode persist as they browse. Knowing where each piece lives helps when diagnosing "it forgot my car" type issues.
In the customer's browser
| Data | Stored in | Lifetime |
|---|---|---|
| Selected vehicle (rego, state, make/model/year, vehicle ID) | localStorage | Persists across visits until cleared. |
| Compatible parts for the selected vehicle | localStorage | Refreshed when the vehicle changes. |
| Selected postcode, suburb, state, location ID, delivery info | localStorage (theme_postcode* keys) | Persists across visits. |
| In-progress installation booking | localStorage | Until the booking is completed or cleared. |
| API auth token (JWT) | sessionStorage | Cleared when the tab closes; refreshed on expiry. |
Because this lives in the browser, a customer on a different device or after clearing their browser data will need to re-enter their vehicle and postcode. That's expected behaviour.
On the Shopify order
When a battery (and installation) is added to the cart, the relevant details are written as line-item properties so they travel with the order into Shopify and are visible to the office: rego/vehicle, customer contact, address, appointment slot, and the Order ID. See the line-item property reference.
This is the bridge between the browser-side experience and the permanent order record the office fulfils from.
On the backend
When a customer books installation, the API also stores a booking record of its own (in its Cloudflare D1 database) keyed by the Order ID — the vehicle, battery, customer, and chosen slot. It starts unconfirmed and becomes confirmed when the order is paid; unpaid records are cleaned up automatically after about an hour. See Installation booking and The backend API.
For developers
State is managed by vehicle-details.js (vehicle), postcode-entry.js (postcode), and
installation.js (booking progress), with the auth token handled by session-manager.js. See
Custom JavaScript modules.