Skip to main content
configure(config) sets how the cart behaves. It’s a set-up call, so it’s safe at the very top of your script, before the cart has loaded.
You can call it more than once and values merge. A later call overrides only the keys it names, leaving the rest alone.
Passing undefined clears a key rather than skipping it. configure({ open_on_add_to_cart: undefined }) resets that option to its default, discarding whatever an earlier call set. To leave an option alone, omit the key entirely.

Options


open_on_add_to_cart

Controls whether the drawer opens when a shopper adds a product.
A common use is to keep the drawer shut on one specific page while leaving the merchant setting alone everywhere else:
If you just want this on for the whole store, it’s already a setting: Cart settings → Content → Behavior → Open cart when an item is added. Use configure when the answer depends on the page, the shopper, or something only your code knows.

open_on_background_add

Set this to true to also open the drawer for background adds — ones Aftersell detected but did not handle itself. An add counts as background when either:
  • it arrived through Shopify’s standard cart events (always treated as background, whatever triggered it), or
  • Aftersell saw the cart request on the wire with no trusted click or keypress in the preceding ~3 seconds — another app or script writing to the cart, for instance.
An add Aftersell saw on the wire that did follow a shopper’s click is not a background add: it already opens the drawer per open_on_add_to_cart, with no need for this option.
This is an additional gate, not an override: a background add opens the drawer only if open_on_add_to_cart would have allowed it too. With open_on_add_to_cart: 'never', this option does nothing.
Reach for this when a third-party add button adds the item correctly but leaves the drawer closed. If the item never reaches the cart at all, that’s an interception problem. See skip_add_to_cart_interceptor and the page builder use case.

validate_form_on_add_to_cart

Runs the browser’s native form validation (reportValidity()) before adding, and cancels the add if the form is invalid. Use it when your product form has required fields (an engraving message, a gift note, a required checkbox) that shoppers can currently skip.
The browser shows its own validation message on the offending field. Off by default, because a theme with a stray required attribute somewhere in the product form would otherwise start silently blocking add-to-cart.

skip_add_to_cart_interceptor

Turns off Aftersell’s add-to-cart interception completely. For what interception does and every way to opt out of it, see Add-to-cart interception. The theme then performs the add itself, and every script listening on that submit runs again. Aftersell still watches for the cart request on the wire, so the drawer opens as usual. You don’t lose it by opting out. On themes Aftersell recognizes, the theme’s own cart stays inert, so you won’t get two carts. On a theme it doesn’t recognize, the theme may open its own cart alongside yours; see Will the theme’s cart open too?.
This one is read once, at boot. It only works from a set-up call that runs before the cart loads: your cart’s Initialization script. Setting it later (inside ready(), or from an event handler) has no effect, and fails silently.
This is a blunt instrument that disables interception for every form on the page. To exempt just one form, use the registerSkipAddToCartRule hook instead:

skip_open_cart_interceptor

Clicking the cart icon opens the Aftersell drawer. To do that reliably, Aftersell stops the click so nothing else on the page handles it, which also stops your scripts from seeing it. If an analytics or pixel event fires everywhere except the cart icon, this is why. Set this to true to stop silencing the click:
Your listeners then run, and the drawer still opens exactly as before. The click also still doesn’t navigate to /cart.
This does less than the name suggests. It doesn’t skip the cart-icon interceptor. It only stops it silencing other listeners. Aftersell still handles the click and still opens your cart. For a control that Aftersell should ignore completely, use the aftersell-cart-wont-open-cart class instead; see Add-to-cart interception.
Unlike skip_add_to_cart_interceptor, this one is read on every click, so you can set it at any point and it takes effect immediately: from ready(), an event handler, or conditionally per page.
Some themes also respond to the cart-icon click themselves. Once Aftersell stops silencing it, a theme that opens its own drawer will do so alongside yours. If you see two carts after turning this on, add the aftersell-cart-wont-open-cart class to the theme’s icon and open the cart from your own handler with actions.open().

money_format

Overrides the Shopify money format that formatMoney uses. Defaults to your store’s own format; if that’s unavailable, prices fall back to $X.XX.
Because configure merges and formatMoney reads the live value, you can change the format at runtime, for example when a currency switcher fires:
This changes how the SDK and the cart display prices. It doesn’t change the currency the shopper is charged; that’s Shopify Markets.

Where to go next

  • Actions: read and change the cart.
  • Hooks: per-form and per-line control, where configure is too broad.
  • Use cases: complete solutions to common requests.