E-commerce Glossary · 3 min read

What is an AJAX Cart?

Understanding AJAX Cart in E-commerce

Quick Definition

An AJAX cart is a shopping cart that updates in the background, without a page reload. When a shopper adds an item, changes a quantity or removes something, the page sends that change to the store and updates just the cart. The shopper stays where they were.

What AJAX Stands For

AJAX is short for Asynchronous JavaScript and XML. Put simply, code on the page talks to your store in the background. The data's usually JSON now, not XML, but the name stuck.

Without it, adding an item usually sends the shopper to the cart page, and each quantity change reloads it. On slow mobile data, every reload is a pause. AJAX cuts that pause from cart actions. The rest of your store isn't any faster.

Example: A Tea Shop Cart

A cart holds a $12 tin of green tea and a $20 teapot. The subtotal is $32. The shopper changes the tea from 1 to 3.

  • Without AJAX: the browser loads a whole new page just to change two numbers.
  • With AJAX: one small background request goes to /cart/change.js and the store sends back the updated cart. The tea line reads $36, the subtotal $56. Nothing else on screen changes.

How Shopify Themes Do It

Shopify gives themes a set of cart addresses for this, the Ajax API. /cart/add.js adds an item, /cart/change.js edits a line and /cart.js returns the cart.

To see it, add an item, then open your-store.com/cart.js in a new tab. You'll get the cart as plain text. Prices are in cents, so a $12 item reads 1200.

If a drawer or popup opens after an add and the page never reloads, your theme's using AJAX. That's why people mix up AJAX carts and cart drawers. AJAX is the plumbing. A cart drawer is one screen built on it, and a regular cart page can use it too.

When an App Adds Items

Apps can use the same route. Say an upsell app adds a product in the background. The cart's correct, but if your theme isn't told, its cart icon can show the old count until the page reloads. Test any app that adds items: does the cart update right away?

Still choosing an app? Start with our list of the best Shopify upsell and cross-sell apps. For what to show in the cart, see our guide to AJAX cart drawer upsells.

Myth: Skipping the Reload Always Helps

A full reload at least shows something happened. A background update is silent. If your theme shows no drawer, popup or new count, a shopper may think the tap failed. If they tap again, they end up with two. You've swapped one kind of friction for another.

Related Terms

Growth Suite for Shopify

Put AJAX Cart into practice

Ready to apply these concepts to your store? Growth Suite provides the tools you need to implement effective ajax cart strategies.

Explore more

Resources

All resources
Shopify Upselling & Cross-Selling - Growth Suite

Topic ·9 min read

Shopify Upselling & Cross-Selling

Most Shopify stores leave 10-30% of revenue on the table because they do not upsell or cross-sell effectively. This...

Shopify Countdown Timer - Growth Suite

Topic ·4 min read

Shopify Countdown Timer

Adding a timer takes 5 minutes. Making it convert without destroying trust? That's strategy. The complete guide to...

Shopify Cart Abandonment - Growth Suite

Topic ·3 min read

Shopify Cart Abandonment

70% of Shopify carts are abandoned. Learn why customers leave, how to prevent abandonment in real-time, and recover...

Shopify Discount - Growth Suite

Topic ·3 min read

Shopify Discount

Master Shopify discounts without sacrificing your profit margins. Learn strategic discount techniques, timing...