UtilitiesDebugger
Console API
The nextDebug global is the fastest way to inspect SDK state and trigger cart actions without modifying your page code.
It is only defined when the debugger is enabled. See Get Started for the three ways to turn it on.
Inspecting State
Every Zustand store is exposed under nextDebug.stores:
nextDebug.stores.cart.getState() // current cart state
nextDebug.stores.campaign.getState() // campaign data
nextDebug.stores.config.getState() // SDK config
nextDebug.stores.checkout.getState() // checkout form state
nextDebug.stores.order.getState() // post-purchase order
nextDebug.stores.attribution.getState() // UTM/referral data// One-liner: how many items in the cart?
nextDebug.stores.cart.getState().items.length
// What is the active currency?
nextDebug.stores.config.getState().selectedCurrencyCart Operations
// Add a package by ref_id
nextDebug.addToCart(packageId)
nextDebug.addToCart(packageId, 3) // with quantity
// Remove a package
nextDebug.removeFromCart(packageId)
// Update quantity
nextDebug.updateQuantity(packageId, 5)
// Quick add three test items at once (packages 2, 7, 9)
nextDebug.addTestItems()These all go through the regular cart store actions, so they trigger every cart event and re-render any bound display elements.
Campaign Operations
// Reload the campaign from the API
nextDebug.loadCampaign()
// Clear the cached campaign data
nextDebug.clearCampaignCache()
// View cache info as a table in the console
nextDebug.getCacheInfo()
// Inspect a specific package
nextDebug.inspectPackage(123)
// Test a shipping method
await nextDebug.testShippingMethod(2)Order & Upsell Operations
// Print the upsell journey as a table
nextDebug.order.getJourney()
// Has the order expired?
nextDebug.order.isExpired()
// Clear the order from sessionStorage
nextDebug.order.clearCache()
// Print order stats (refId, age, viewed/completed upsells)
nextDebug.order.getStats()Attribution & UTM
// Print full attribution debug
nextDebug.attribution.debug()
// Get the attribution payload sent to the API
nextDebug.attribution.get()
// Set the funnel name manually
nextDebug.attribution.setFunnel('summer-2026')
// Set the Everflow click ID
nextDebug.attribution.setEvclid('abc123')
// Print the current funnel
nextDebug.attribution.getFunnel()
// Clear the persisted funnel
nextDebug.attribution.clearFunnel()Analytics
// Get analytics provider status
await nextDebug.analytics.getStatus()
// List active providers
await nextDebug.analytics.getProviders()
// Track a custom event
await nextDebug.analytics.track('test_event', { foo: 'bar' })
// Toggle analytics debug mode (verbose console logging)
await nextDebug.analytics.setDebugMode(true)
// Force re-evaluation of analytics context (page type, etc.)
await nextDebug.analytics.invalidateContext()Accordion Control
nextDebug.accordion.open('faq-1')
nextDebug.accordion.close('faq-1')
nextDebug.accordion.toggle('faq-1')SDK Lifecycle
// Reinitialize the SDK from scratch (useful after config changes)
await nextDebug.reinitialize()
// Get init stats (number of enhancers, scan time, etc.)
nextDebug.getStats()
// Get the NextCommerce singleton
nextDebug.sdkCustom Event Logging
The Event Timeline panel listens for a debug:log custom event. Dispatch it from your own code to drop entries into the timeline:
window.dispatchEvent(new CustomEvent('debug:log', {
detail: {
type: 'custom',
message: 'Coupon was applied via my custom flow',
data: { code: 'SAVE10', orderId: 'ORD-123' },
},
}));Force a panel refresh:
window.dispatchEvent(new CustomEvent('debug:update-content'));Mode Control
nextDebug.enableDebug() // turn on (adds ?debugger=true to URL)
nextDebug.disableDebug() // turn off (removes the param)
nextDebug.toggleDebug()
nextDebug.isDebugMode() // booleanThese are useful from a bookmarklet or another debugger session — you don't need to type them by hand if you used ?debugger=true to get here.
Next Steps
- Full method list with signatures: Reference → Methods