Skip to main content

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

  • The Ollie Shop CLI installed (npm install -g @ollie-shop/cli) — see Installation
  • A scaffolded project (npx create-ollie-shop) — see the Quickstart
  • 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 and a meta.json:
2

Add meta.json

meta.json tells the tooling where the component goes. The slot is where it renders in the checkout (see Slots). Leave id out for local development — an unlinked component gets a temporary studio-* id until you register it.
meta.json

Build the Component

Create components/FreeShippingBar/index.tsx:
index.tsx

Add Styles

Create components/FreeShippingBar/styles.module.css:
styles.module.css

Test Locally

Start the local dev server from your project root:
This discovers your components, opens Ollie Studio in the browser, and hot-reloads as you edit.

Register & Deploy

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

Deploy

Deploy bundles the local components/FreeShippingBar folder and uploads it to the builder. Pass the component id from the previous step and the folder name:
--wait polls until the build finishes.
3

Verify

Using Checkout Data

The SDK exposes hooks for reading checkout data. useCheckoutSession returns the parsed session:
See the hooks reference and the CheckoutSession type for the full shape.

Adding Interactivity

Cart changes go through useCheckoutAction, not useCheckoutSession:

Best Practices

Performance

Error Handling

Surface failures to the user via useMessages:

Accessibility

Next Steps

Custom Component 101

A fully custom CartItem walkthrough

API Reference

Complete SDK documentation