For the complete documentation index, see llms.txt. This page is also available as Markdown.

BYOB SDK

window.eliteBundle.sdk.byob — live BYOB state and actions, updated on every React render.

Available after the elite:byob:ready event fires. null when no BYOB bundle is on the current page.


State

bundleId

string

The Shopify product ID of the bundle. Stable identifier — use this to associate external state with a specific bundle.


steps

ResolvedStep[]

All configured bundle steps, each populated with fetched Shopify product and variant data.

interface ResolvedStep {
  id: string;
  title: string;
  minQuantity: number;
  maxQuantity: number | null;
  enableSelectionLimit: boolean;
  products: ShopifyProduct[];
}

interface ShopifyProduct {
  id: string;
  title: string;
  handle: string;
  featuredImage: { url: string; altText: string | null } | null;
  variants: ProductVariant[];
}

interface ProductVariant {
  id: string;          // GID, e.g. "gid://shopify/ProductVariant/123"
  title: string;       // e.g. "Red / Small"
  price: string;       // numeric string, e.g. "29.99"
  available: boolean;
  image: { url: string; altText: string | null } | null;
  selectedOptions: { name: string; value: string }[];
}

Example:


isLoading

boolean

true while products are being fetched from the Storefront API. The elite:byob:ready event only fires after this becomes false.


error

string | null

Non-null when product fetching failed. The elite:byob:error event fires at the same time.


cart

CartItem[]

Current bundle cart contents.


cartTotal

number

Sum of price × quantity for all cart items. Rounded to 2 decimal places.


cartTotalFormatted

string

cartTotal formatted using the store's money format, e.g. "$49.99". Use this for display.


cartCount

number

Total quantity of items across all cart entries.


canCheckout

boolean

true when all steps with minQuantity constraints are satisfied. Gate your checkout button on this.


isTierMaxReached

boolean

true when cartCount has reached the highest discount tier's quantity threshold. Useful for hiding "add more for a discount" prompts.


isCheckingOut

boolean

true while the cart POST request is in flight. Use to show a loading state on your checkout button.


checkoutError

string | null

Non-null when the last checkout attempt failed. The elite:byob:checkout-error event also fires.


discountConfig

DiscountSettings

The discount configuration for this bundle. Inspect this to build a tier progress indicator.

Example:


Actions

formatPrice(amount)

Formats a numeric amount using the store's money format and active currency rate.


addToCart(product, variantId, stepId?)

Adds one unit of a variant to the bundle cart. Pass the full product object and the variant GID.

stepId is optional — when omitted, the system uses the variant's resolved step automatically.


removeFromCart(variantId, stepId?)

Removes all units of a variant from the cart. Include stepId if the same variant can appear in multiple steps.


updateQuantity(variantId, delta, stepId?)

Increments or decrements the quantity of a cart item. Use +1 or -1. If quantity reaches 0, the item is removed.


getItemQuantity(variantId, stepId?)

Returns the current quantity of a specific variant in the cart. Returns 0 if not present.


isStepFull(stepId)

Returns true when a step has enableSelectionLimit enabled and its maxQuantity has been reached. Use to disable the add button for a step.


canAddToStep(stepId)

Returns true when adding another item to this step is still allowed. Inverse of isStepFull for steps with a limit; always true for unlimited steps.


checkout(redirectTarget?)

Posts the bundle cart to Shopify and handles the redirect.

redirectTarget

Behavior

"checkout" (default)

Redirects to Shopify checkout

"cart"

Redirects to /cart

"stay_on_page"

No redirect — stays on the product page


Full example

Last updated

Was this helpful?