Skip to main content
Aftersell intercepts add-to-cart on standard Shopify product forms. Landing page builders often add to the cart their own way, using a JavaScript call instead of a form submit, so the item lands in the cart but the drawer stays shut, or the shopper gets redirected to /cart.

The fix, in one line

After the builder’s add-to-cart finishes, tell the cart to refetch and open:
Add this as a second action on the button, after the builder’s own “add to cart”, and turn off the builder’s “go to cart” or “redirect after add” option.
Try open_on_background_add first, since it often solves this without touching the button at all.

The no-code option first

Aftersell detects adds it didn’t handle itself in two ways. Both run at all times — they are attached together at boot and neither suppresses the other, so one add can be announced by both — and each announcement applies the open rule independently:
  • On the wire. Aftersell watches for requests to Shopify’s cart endpoints. If the add followed a real click or keypress within about three seconds, it counts as shopper-driven, and the drawer opens according to your normal Open cart when an item is added setting. Any builder that adds through Shopify’s Ajax cart API (/cart/add.js) lands here, which is the common case — so try your button first, it may already work with no changes at all.
  • Shopify’s standard cart events. An add announced this way is always treated as a background add, whether or not a shopper clicked. Background adds don’t open the drawer unless you opt in:
Paste that into Cart settings → Custom script → Initialization. If the drawer now opens after your builder’s add button, you’re done, with no per-button work, and it covers every page.
open_on_background_add also covers adds with no shopper gesture at all — another app or script writing to the cart. Turn it on only if you want those to pop the drawer too.
If neither path opens the drawer, fall back to the explicit call below.

Per-builder setup

Replo

  1. Open your page in the Replo editor and select the Add to Cart button.
  2. In the right sidebar, open the Interactions tab.
  3. Under On Click, click + and choose Run JavaScript.
  4. Paste:
  5. Select the Add Product to Cart interaction again and turn Go to cart after? off.
  6. Preview, confirm the drawer opens, then publish.
Repeat on each page that has an add-to-cart button.

PageFly and GemPages

Both let you attach custom JavaScript to a button click or add a custom code element to the page. Use the same snippet, wired to run after the builder’s add-to-cart action, and disable any “redirect to cart” setting on the button.

Your own button

If you’re adding to the cart yourself, skip the round trip and use the SDK’s own action, which updates the cart and can open the drawer in one step:
Use refresh() only when something else changed the cart and you need Aftersell to catch up:

When the builder’s button should bypass Aftersell entirely

Sometimes the opposite is true: a form needs its own flow, and Aftersell’s interception gets in the way. Exempt just that form:
Then add data-skip-aftersell to the form. This is better than skip_add_to_cart_interceptor, which turns interception off for every form on the page. Simpler still, if you can edit the form’s markup: add the class aftersell-cart-skip-atc to the <form> and Aftersell skips it, no script needed.

Troubleshooting

Check window.aftersellCartDebugEvents if a call seems to do nothing, since SDK failures are swallowed rather than thrown.

Where to go next

  • Configure: open_on_background_add and the other drawer options.
  • Actions: refresh, open, and addItem.
  • Hooks: exempting a single form.