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.
Options
open_on_add_to_cart
Controls whether the drawer opens when a shopper adds a product.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 totrue 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.
open_on_add_to_cart, with no need for this option.
open_on_add_to_cart would have allowed it too. With open_on_add_to_cart: 'never', this option does nothing.
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.
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?.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 totrue to stop silencing the click:
/cart.
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 thatformatMoney uses. Defaults to your store’s own format; if that’s unavailable, prices fall back to $X.XX.
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.