BigCommerce Checkout Customization
Before writing code
Fetch live docs:
- Fetch
https://developer.bigcommerce.com/docs/storefront/cart-checkout/checkout-sdkfor Checkout SDK - Web-search
site:developer.bigcommerce.com checkout apifor Checkout API reference - Web-search
bigcommerce embedded checkout headlessfor embedded checkout patterns
Checkout Architecture
Three Approaches
| Approach | Where | Use Case |
|---|---|---|
| Native Checkout | BigCommerce storefront | Default — customize via SDK or theme |
| Embedded Checkout | External site (iframe) | Headless with BigCommerce-hosted checkout |
| Custom Checkout | Your own frontend | Fully custom using Checkout/Payments API |
Checkout SDK
What It Is
A JavaScript SDK for customizing the native BigCommerce checkout:
- Renders checkout UI in a target DOM element
- Provides methods to interact with checkout state
- Fires events for checkout lifecycle
- Available as
@bigcommerce/checkout-sdknpm package
Installation
npm install @bigcommerce/checkout-sdk
Core Methods
import { createCheckoutService } from '@bigcommerce/checkout-sdk';
const service = createCheckoutService();
// Load checkout
await service.loadCheckout(checkoutId);
// Get current state
const state = service.getState();
const checkout = state.data.getCheckout();
// Update shipping address
await service.updateShippingAddress(address);
// Select shipping option
await service.selectShippingOption(optionId);
// Apply coupon
await service.applyCoupon(code);
// Submit order
await service.submitOrder(orderPayload);
State Selectors
The state object provides selectors:
getCheckout()— full checkout datagetCart()— cart items and totalsgetCustomer()— customer infogetShippingAddress()— shipping addressgetBillingAddress()— billing addressgetShippingOptions()— available shipping methodsgetPaymentMethods()— available payment methodsgetOrder()— completed order
Checkout Events
Subscribe to state changes:
service.subscribe(state => {
const checkout = state.data.getCheckout();
// React to checkout state changes
});
Embedded Checkout
How It Works
Embed BigCommerce's checkout in an external site via iframe:
- Create a cart via the Server-to-Server Cart API
- Generate a checkout URL (from the cart's
redirect_urls.checkout_url) - Embed the URL in an iframe on your site
- Listen for
postMessageevents from the iframe
Setup
Include the Embedded Checkout script:
import { embedCheckout } from '@bigcommerce/checkout-sdk';
embedCheckout({
url: checkoutUrl,
containerId: 'checkout-container',
onComplete: () => { /* order placed */ },
onError: (error) => { /* handle error */ },
onFrameLoad: () => { /* checkout loaded */ },
});
Requirements
- HTTPS on your domain
- Configure "Trusted Domains" in BigCommerce admin
- Set
X-Frame-Optionsand CSP headers to allow embedding
Server-Side Checkout API
Cart to Checkout Flow
- Create Cart:
POST /v3/cartswith line items - Add Billing Address:
POST /v3/checkouts/{id}/billing-address - Add Consignment (Shipping):
POST /v3/checkouts/{id}/consignments - Select Shipping Option:
PUT /v3/checkouts/{id}/consignments/{consignmentId} - Create Order:
POST /v3/checkouts/{id}/orders - Process Payment:
POST /v3/payments(via Payments API)
Key Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/v3/carts | POST | Create cart |
/v3/carts/{id}/items | POST, PUT, DELETE | Manage cart items |
/v3/carts/{id}/redirect_urls | POST | Get checkout URL |
/v3/checkouts/{id} | GET | Get checkout state |
/v3/checkouts/{id}/billing-address | POST, PUT | Set billing address |
/v3/checkouts/{id}/consignments | POST | Add shipping info |
/v3/checkouts/{id}/coupons | POST, DELETE | Apply/remove coupons |
/v3/checkouts/{id}/orders | POST | Create order from checkout |
Checkout Customization in Stencil
Theme Template
Checkout uses templates/pages/checkout.html with special handling:
- Uses the
emptylayout (minimal wrapper) - Checkout UI is primarily JavaScript-rendered
- Limited template customization compared to other pages
Checkout JS Customization
Override checkout JavaScript for UI modifications:
- Fork the open-source checkout:
github.com/bigcommerce/checkout-js - Build custom React checkout components
- Deploy as a custom checkout script
Best Practices
- Use Embedded Checkout for headless — avoids PCI scope expansion
- Use the Checkout SDK for programmatic control
- Always use HTTPS for checkout flows
- Handle payment failures gracefully with clear error messages
- Test the full checkout flow with real payment sandbox credentials
- Support guest checkout and registered customer checkout
- Validate all addresses server-side
- Handle coupon edge cases (expired, minimum spend, etc.)
Fetch the Checkout SDK docs and BigCommerce Checkout API reference for exact method signatures, state structure, and configuration options before implementing.