November 3, 2026

What a Cart Shipping Estimate Costs When Nobody Clicks It

When we read through the negative reviews of shipping calculator apps, the complaint that came back most often was not that the rates were wrong. It was that the store got slower. So when we added a shipping estimate to the cart page of our own cart app, the first thing we wrote down was not the design. It was the size budget.

The budget was wrong, in a way that would never have announced itself. Here is how, and the two other numbers we found while fixing it.

A budget that was already true on day one

The first version said: under 30 KB. That sounds strict until you measure what is already on the page. Our existing cart script is 30,974 bytes raw and 9,530 compressed, and the platform's own guidance suggests keeping a theme app extension script under 10 KB compressed. The budget was satisfied before a single line of the new feature existed, and it would have stayed satisfied while the cart page got slower.

A ceiling that the current state already meets is not a budget. It is a description of the past. The replacement names the mechanism, not just the number:

Measured, the built widget is 5,548 bytes raw and 2,434 compressed. The 8 KB is not a limit we inherited from anyone; it is this feature's own argument for existing as a separate file. If the calculator ever needs more than that, it has stopped being the small thing that earned the right to be loaded on demand.

The ceiling also lives in a build test, not in anyone's review habits. A number that only exists in a plan is checked by whoever remembers it.

Before: a thirty kilobyte ceiling, already met by the existing cart script at 30,974 bytes raw and 9,530 compressed. After: own file, first click only, under 8 KB compressed, checked by a build test, measured at 2,434 bytes.

The part that cannot be loaded later

Zero bytes until a click is the easy half. What every cart view carries, whether or not the shopper ever looks at shipping, is the block's markup, a short inline bootstrap, and a JSON island holding the data the widget needs in order to start: the countries the store ships to.

That last part means there is no single number. It follows the merchant's own configuration:

The island is a script element of type application/json, so the browser downloads it and does nothing else with it: no parsing, no execution, no main thread time, even in the ships-everywhere case. That is why we were willing to put the data on the page instead of fetching it on demand. It is also why the honest figure to publish is three numbers rather than one, and why the one we would have quoted, the 2,434 bytes nobody downloads unless they click, is the least interesting of them.

Every cart view carries the block markup, the inline bootstrap and the JSON island: 1,299 bytes compressed for one market, 1,394 for ten, 2,838 for around 250. The calculator asset, 2,434 bytes compressed, is fetched only on the first click.

More calls, because the single call is throttled

Shopify's storefront cart API has a synchronous endpoint that returns shipping rates in one request, and the documentation says it is throttled. The asynchronous pair is two steps instead: one request starts the calculation, then a poll returns rates once they are ready and null until then. We poll every 600 ms and give up after 10 seconds.

So the fast path is the one with more round trips. It is also the cheap path in every other sense. It needs no extra access permission, it pulls in no third party script, and the postcode the shopper types goes to the shop's own domain and stays in the browser otherwise.

One limit belongs in the same paragraph as the feature rather than in a footnote: these endpoints exist only on themes hosted by Shopify. On a custom storefront they are not there at all. When the widget gets a 404, or a theme that answers the path with its own HTML error page, it takes itself off the cart entirely. A shopper is better served by the theme's plain cart than by a form that can never answer.

One synchronous call returns rates but is documented as throttled. The asynchronous pair starts the calculation and then polls every 600 ms up to a 10 second ceiling, which is the path the widget uses.

Who decides where it appears

There were two ways to get the widget onto a cart page. Either the merchant drags a block into the cart template in the theme editor, or the app injects it into the theme's own cart markup from a script that is already loaded.

The second is one setup step fewer, and it is also exactly the failure class the category's negative reviews are made of: an app guessing where a theme puts things, and guessing wrong on the theme you happen to run. So the block went first. The injected variant exists as a design constraint rather than as a promise: the widget's core draws into the element it is handed and never searches the page for cart markup, so a container made some other way can call the same function without a rebuild. When it ships it will be a switch that starts off, together with the list of themes it was tested on. We are not putting a date on it.

The rule

A performance budget is a test, or it is a wish. Ours was a sentence in a plan, it was already true on the day it was written, and nothing in our process would have told us. What we do now, in our setup:

Back to the complaint we started from, that the store got slower. We cannot measure that for every store, but we can say what this block adds to it. A shopper who never opens the estimate gets between 1,299 and 2,838 bytes compressed on every cart view, depending on how many countries the shop ships to, and the largest part of that, the country list, is never parsed or run. The calculator itself, 2,434 bytes, arrives only for the shopper who asks for it. The second number is the one we would have quoted. The first is the one that answers the reviews.

See the app this block belongs to

This content is freely reusable with attribution (CC BY 4.0). Questions: hello@peci.io

← Back to Blog