Is Your Shopify Cart Slow? Here’s How to Test It, The Complete Guide.

Shopify Cart API Performance Test: Free Script + Benchmarks

A simple guide to measure and benchmark your Shopify store’s cart API response times.


Why Cart Performance Matters

Every millisecond counts in ecommerce. Slow cart operations lead to:

  • Frustrated customers
  • Abandoned carts
  • Lost revenue

The Shopify Cart API (/cart/add.js, /cart.js, /cart/change.js) is the backbone of your store’s shopping experience. Measuring its performance helps you identify bottlenecks before they impact conversions.


Shopify Cart API Performance Test Script

Copy and paste the script below into your browser’s developer console (F12 → Console) on any Shopify store.


(async () => {
  console.log('🧪 Shopify Full Cart API Performance Test');

  const variantId = prompt('Enter a variant ID to test (ensure it is in stock):');
  if (!variantId) return console.error('Test aborted');

  const results = [];

  async function measure(label, url, options = {}) {
    const start = performance.now();
    try {
      const response = await fetch(url, options);
      await response.json();
      const duration = Math.round(performance.now() - start);
      results.push({ label, duration });
      console.log(label + ': ' + duration + 'ms');
    } catch (err) {
      console.error(label + ' failed');
    }
  }

  await measure('ADD', '/cart/add.js', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ id: variantId, quantity: 1 })
  });

  await measure('GET', '/cart.js');

  await measure('CHANGE', '/cart/change.js', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ id: variantId, quantity: 2 })
  });

  console.log('Final Results:', results);
})();

How to Find a Variant ID

  1. Open any product page on your Shopify store
  2. Open browser console (F12)
  3. Run the command below:
console.log(meta.product.variants[0].id)

Copy the numeric ID that appears.


Performance Benchmarks

Endpoint🟢 Good🟡 Acceptable🔴 Slow
/cart/add.js< 500ms500–1000ms> 1000ms
/cart.js< 300ms300–500ms> 500ms
Total< 1500ms1500–2500ms> 2500ms

Summary

  • Use the script to measure your cart API performance
  • Target total cart time under 2,500ms
  • Slow results usually indicate heavy apps or discount logic
  • Test both production and development stores