Overview
This guide walks through building a free shipping progress bar component. You’ll learn how to:- Create a component in your project
- Access checkout data with the SDK
- Run it locally
- Register and deploy it to your store
Prerequisites
- A scaffolded project (
npx create-ollie-shop), see the Quickstart. It installs the Ollie Shop CLI as a dev dependency, sonpx ollieshop ...works from the project root. A global install (see Installation) is optional. - Basic React knowledge
- Access to a store
A component is a folder under
components/ in your project. It is not a
standalone package: ollieshop component create only registers metadata in the
database; it does not scaffold a folder. The actual code lives in your project.Create the Component
1
Create the folder
Inside your project, create
components/FreeShippingBar/ with an index.tsx:2
Declare it in ollie.json
The There is no
components map in ollie.json tells the tooling which folders are
components and where each one renders. The key is a local alias, path is the
folder, and slot is the slot id in the checkout (see
Slots). cart_header_full_page renders above the
cart content and is empty by default, which makes it a good first slot.ollie.json
id yet, so the component is unlinked: the dev server gives it
a temporary studio-FreeShippingBar id until you register it. A folder under
components/ with no entry in the map is still discovered, but without a slot
it is built and not placed anywhere in the checkout.Older projects used a
meta.json file inside each component folder. The CLI
still reads it as a fallback, and npx ollieshop setup migrates those files
into the ollie.json map.Build the Component
Createcomponents/FreeShippingBar/index.tsx:
index.tsx
Add Styles
Createcomponents/FreeShippingBar/styles.module.css:
styles.module.css
Test Locally
Start the local dev server from your project root:Register & Deploy
The quickest route is Studio: open the component’s card, confirm the slot, and click Publish. Studio creates the component record, deploys the build, and writes the new id intoollie.json for you. The steps below do the same thing from the terminal.
1
Register the component
Create the component record in a store version to get its component id. You
can do this in the admin dashboard, or via the CLI:
2
Link the folder to the id
component create does not touch your project files. Replace the alias in
ollie.json with the id it returned, so the folder is linked from now on:ollie.json
3
Deploy
Deploy bundles the local
components/FreeShippingBar folder and uploads it to
the builder. Pass the component id and the folder name:--wait polls until the build finishes.4
Verify
Using Checkout Data
The SDK exposes hooks for reading checkout data.useCheckoutSession returns the
parsed session:
CheckoutSession type for the full shape.
Adding Interactivity
Cart changes go throughuseCheckoutAction,
not useCheckoutSession:
Best Practices
Performance
Error Handling
Surface failures to the user viauseMessages:
Accessibility
Next Steps
Custom Component 101
A fully custom CartItem walkthrough
API Reference
Complete SDK documentation