Skip to main content

Checkout performance guidelines

This chapter contains guidelines for improving the performance of the checkout process.

Taxes recalculation with custom taxes apps

When taxes app is used to calculate taxes (CHECKOUT_CALCULATE_TAXES AND ORDER_CALCULATE_TAXES subscriptions are being used), the app is called every time taxes need to be recalculated.

You may see mutations like checkoutLineAdd or checkoutShippingMethodUpdate being slow, just like the queries that require prices affected by taxes (see TaxedMoney).

To improve checkout (or order - it can be used in the same way) performance, you can optimize your storefront to avoid recalculating taxes when possible.

Example patterns:

  • When calling checkoutLineAdd do not require entire checkout in the response. Check for errors and assume mutation succeeds if there are none.
  • If storefront doesn't show gross prices (they are calculated after shipping is provided), do not require gross price. Use net prices or catalog prices instead.

Optimistic UI

For operations like changing line quantity, you may want to assume that the operation will succeed and update the UI immediately. You can leverage strategy called "optimistic updates" for that.

In the nutshell, frontend can calculate new price locally and update the UI immediately, while the real response will apply with a delay in the background.