Skip to main content

Documentation Index

Fetch the complete documentation index at: https://voyage-theme.fasil.in/llms.txt

Use this file to discover all available pages before exploring further.

Voyager ships a small public JavaScript API designed for advanced merchants and app developers. Every entry point is either a global function on window, a custom event dispatched on a known element, or a data-* attribute that triggers behavior when added to any element. The theme is deliberately framework-free — vanilla JS, no build step — so you can call into it from any inline script, any Shopify app, or any custom snippet you add via the Custom Liquid block.

Global functions

window.voyageToast(message, type?)

Display a toast notification at the bottom of the viewport for ~2.2 seconds.
window.voyageToast('Added to bag');
  • message — the string to display. Required.
  • type — optional. Reserved for future variants (success / error styling). Currently any value falls back to the default visual treatment.
A toast element is lazily created on first call and reused for subsequent calls. Calls within the 2.2s display window reset the timer rather than queuing — only the most recent message is shown. Defined in: assets/theme.js.

window.refreshCart()

Re-fetch the cart drawer and update the item count badge. Returns a promise that resolves once the DOM has been updated.
await window.refreshCart();
The function uses Shopify’s Section Rendering API (/?sections=cart-drawer) to fetch fresh server-rendered markup for the drawer, then replaces the drawer’s contents. It also fetches /cart.js and updates every [data-cart-count] element on the page, animating any badge whose count increased. Call this whenever you’ve mutated the cart from custom JavaScript — adding a line item, applying a discount, removing an item via the AJAX API. Defined in: assets/theme.js.

Custom events

Voyager’s JavaScript is bound primarily through DOM event delegation rather than CustomEvent dispatch — most behavior is keyed off click events on elements with specific data-* attributes. The one notable dispatched event:
EventWherePurpose
inputQuick-view qty input (bubbles: true)Triggers the variant picker to recompute total when qty changes
For most custom integrations, the better pattern is to call window.refreshCart() after a cart mutation rather than listening for a dispatched event.

Data-attribute hooks

Voyager uses data-* attributes extensively to bind behavior to markup. Adding any of these attributes to your own markup (in a Custom Liquid block, in a section template, or via an app) wires the element into Voyager’s JavaScript automatically.

Cart drawer

AttributeWhere to put itBehavior
data-cart-openAny clickable element (link, button)Opens the cart drawer on click
data-cart-closeAny clickable elementCloses the cart drawer on click
data-cart-drawerThe drawer container itselfMarks the element as the drawer target for refreshCart
data-cart-backdropThe drawer’s backdrop overlayCloses the drawer when clicked
data-cart-countA <span> elementLive cart item count — updated automatically by refreshCart

Quick-view modal

AttributeWhere to put itBehavior
data-quickviewThe modal containerMarks the modal target
data-quickview-triggerA button on a product cardOpens the quick-view for that product
data-quickview-closeA button inside the modalCloses the modal
data-quickview-formThe form inside the modalSubmits to add-to-cart
data-quickview-variant-idA hidden inputStores the selected variant ID
data-quickview-priceA <span>Updated as variants change
data-quickview-qtyA number inputQuantity stepper input
data-quickview-qty-upA buttonIncrements the qty
data-quickview-qty-downA buttonDecrements the qty

Magnetic buttons

AttributeWhere to put itBehavior
data-magneticA wrapping <span> around a buttonApplies the magnetic cursor-follow effect. Value is the strength multiplier (e.g. 0.18).
Class magnetic(Equivalent shorthand)Same as data-magnetic with default strength

Custom cursor

AttributeWhere to put itBehavior
data-cursor="hover"Any interactive elementCursor enlarges and dot inverts on hover
data-cursor="image"A gallery thumbnail or product imageCursor renders an image-preview lens
data-cursor="text"A text input or contenteditable elementCursor renders as a text beam

Scroll reveals

AttributeWhere to put itBehavior
Class revealAny elementAnimates from 16px below into place on scroll-in
Class reveal-imgAn imageAnimates with the blur-to-clear transition
data-revealAny elementSame as reveal class — for use when classes are reserved
--reveal-delay (CSS var)Inline styleStagger delay in ms — useful in loops

Filters and grid

AttributeWhere to put itBehavior
data-filters-toggleA buttonOpens the filter sidebar drawer
data-filters-closeA buttonCloses the filter sidebar
data-sort-formThe sort <form>Marks the form for the dropdown behavior
data-sort-toggleA buttonOpens the sort menu
data-sort-optionA button inside the menuCarries the sort value
`data-view=“234list”`A button in the view pickerSets the grid column count or list view; persisted in localStorage

Chip nav

AttributeWhere to put itBehavior
data-chips-scrollThe chip nav wrapperMarks it for the horizontal scroll JS
data-at-start, data-at-endSame wrapperToggled true/false to fade the leading/trailing edge
AttributeWhere to put itBehavior
data-search-inputThe search <input>Debounced fetch to /search?view=json on input
data-search-resultsA <div>Receives the rendered predictive results
data-search-panelThe dropdown panelMarks the visibility target

PDP

AttributeWhere to put itBehavior
data-pdp-formThe product formMarks the form for the variant picker JS
data-pdp-variant-idA hidden inputStores the selected variant ID
data-pdp-optionA radio inputMarks the input as a variant option, with the option index as the value
data-pdp-priceA <span>Updated as variants change
data-pdp-price-compareA <span>Updated with compare-at price when applicable
data-pdp-atcThe add-to-cart buttonDisabled when the variant is sold out
data-pdp-atc-totalA <span> in the button labelLive cart-total preview
data-pdp-galleryThe gallery containerMarks it for the cursor-follow zoom JS
data-pdp-gallery-thumbA thumbnail buttonClicking switches the lead image
data-pdp-gallery-main-imgThe <img> elementReceives the new src
data-pdp-color-labelA <span> near the titleUpdated with the selected color value
data-zoom-imgThe hover-zoom containerThe 2400px-wide zoom image URL
--zx, --zy (CSS vars)Same containerThe current zoom focus point in percent
data-sf-toggleA buttonOpens the size finder panel
data-sf-panelA <div>The size finder panel
data-sf-brand, data-sf-size<select> elementsInputs for the size cross-reference
data-sf-recA <strong>The recommended size output
data-sf-useA buttonApplies the recommended size to the product form

Quantity steppers

AttributeWhere to put itBehavior
data-qty-downA <button>Decrements the sibling [data-qty-input]
data-qty-upA <button>Increments the sibling [data-qty-input]
data-qty-inputA <input type="number">The quantity input
AttributeWhere to put itBehavior
data-nav-toggleA burger buttonOpens the mobile nav drawer
data-nav-drawerThe drawer containerMarks the drawer target
data-nav-groupA submenu wrapperMarks a collapsible nav group
data-nav-group-toggleA buttonToggles the group
data-theme-toggleA buttonToggles data-theme="dark" on <html>
data-sound-toggleA buttonToggles click sounds; updates icons
data-currency-switcherA <div>Marks a currency switcher
data-lang-switchA <div>Marks a language switcher

Misc

AttributeWhere to put itBehavior
data-scroll-marqueeA wrapperApplies a horizontal-scroll marquee transform
data-click-sound="soft"Any clickablePlays the soft click variant on click
data-pcard-videoA <video> in a product cardPlays/pauses on enter/exit viewport
data-section-idA section rootCarries the Shopify section ID for the section-rendering API

Files

The full implementation lives in two files:
FileWhat’s in it
assets/theme.jsThe main orchestrator — reveals, magnetic, cursor, sounds, scroll, nav, cart drawer, quick view, predictive search, page transitions, PLP toolbar, scroll marquee, theme toggle, toast
assets/pdp.jsProduct page islands — variant picker, gallery, zoom, size finder, share, accordion
assets/bundle.jsBundle section — hotspot selection, “add bundle to cart” flow
assets/hero-carousel.jsHero slideshow auto-advance and slide transitions
assets/image-slot.jsInline image-slot placeholder component

What’s next

CSS tokens

The design tokens consumed by every component.

Customization recipes

Examples of using these hooks in custom integrations.