ShopAssist
Reference

Configuration

Every field the widget accepts, and which settings come from the dashboard instead.

ShopAssistConfig

FieldTypeDefaultWhat it is
shopDomainstring—Required. Your shop identifier. On a headless Shopify store this is the *.myshopify.com domain, not the public URL.
platform"custom" | "shopify" | "woocommerce" | "idosell"customThe storefront platform.
apiUrlstringhttps://api.getshopassist.comThe ShopAssist API.
languagestringdetectedUI language hint, such as en, de or sl.
customerIdstring—Signed-in customer id. Powers order lookup.
customCustomStorefrontConfig—Storefront routing and locale. See below.
cartShopAssistCartBridge—Cart bridge. See below.
scriptUrlstringthe CDN bundleOverride the widget bundle URL, for self-hosting or local testing.

Only shopDomain is required.

ShopAssist({ shopDomain: "your-shop.com" });

What the dashboard owns

Colors, button position and icon, greeting, modal title, tooltip text, suggestion chips, notification sound and delay, and the page, locale and country rules all come from your ShopAssist dashboard. They are not fields on this object.

This is deliberate: those are the settings a merchant changes, and a merchant cannot deploy your storefront. If you set them in code they are overwritten on load, which looks like the widget ignoring you.

Storefront routing

Set this when your product URLs are not /products/<handle>, or when the widget cannot tell what kind of page it is on.

FieldTypeDefaultWhat it is
currencystringUSDCurrency for the storefront context sent to the API.
languagestringenStorefront language.
countrystringUSStorefront country.
routePrefixstring—Prefix for localized routes, such as /en.
productUrlPatternstring/products/{handle}Template for product links. {handle} is the product slug.
productPagePatternstring/products/([^/?#]+)Regular expression with one capture group, used to detect a product page and read the handle.
cartUrlstring/cartCart page URL.
checkoutUrlstring—Checkout URL. A custom storefront has no conventional checkout route, so without this the post-add banner can only offer the cart.
detectLanguagebooleanfalseFollow <html lang> live instead of the static language.
ShopAssist({
  shopDomain: "your-shop.com",
  custom: {
    currency: "EUR",
    language: "sl",
    country: "SI",
    productUrlPattern: "/izdelek/{handle}",
    productPagePattern: "/izdelek/([^/?#]+)",
  },
});

productPagePattern is a regular expression with exactly one capture group, which must capture the handle.

detectLanguage is for storefronts with a language switcher. With it on, the widget follows <html lang> as the page changes, and language becomes the fallback for when the attribute is missing.

The cart bridge

FieldTypeWhat it does
add(variantId, quantity, properties?) => void | Promise<void>Required. Adds a variant to your cart. The widget waits for a returned promise.
open() => voidCalled after a successful add, to open your cart drawer.

See add to your cart.

Opening the chat

FieldTypeWhat it does
messagestringSent as the first message of a fresh session.
sourceOpenSourceRecords where the conversation began.
faqIdnumberServes a stored answer as written instead of calling the model.

source records where a conversation began, and feeds the "Where conversations started" breakdown in your weekly report.

Boot outcomes

status() returns one of three values once the widget has settled, or null while it is still loading.

ValueMeaning
mountedThe widget is on screen.
disabledThe shop is turned off in the ShopAssist dashboard.
gatedA page, locale or country rule excluded this page.

disabled and gated are both normal outcomes, not failures. A rejected load() is the failure case, and it means the bundle did not load at all.

Last updated on

On this page