How to Improve the Checkout Performance of your Shipping App

checkout performance shipping app

Checkout performance is a major factor in helping merchants get more sales, which is why we strive to ensure that shipping rates at checkout load at the optimal speed and withoutperceptible delay.

If you build shipping apps, that also means that your app needs to be just as fast. To help app developers create optimal checkout experiences and return shipping options fast (< 500ms) and reliably, we have consolidated a list of six best practices to improve the checkout performance of your shipping app.

1. Store carrier retail rates internally

Many shipping apps function as aggregators for multiple shipping carriers in order to offer merchants rate-shopping functionalities. To avoid poor responsiveness of your shipping app, this dependency on carriers’ backed performance should be reduced when possible. We recommend storing carrier retail rates internally to avoid any external call.

2. Cache carrier rates

For carrier rates that are highly dynamic or merchant-specific, there may be an opportunity to build a caching layer. While not every call to a given carrier will result in the same response, there will likely be a pattern for which rates are identical. Based on this, you can define a cache key. At Shopify, we built a self-healing caching system to significantly reduce the number of external calls and our dependence on shipping carriers’ backend systems.

We recommend following these steps:

  • Analyze the response data to external calls in your system and identify patterns across various use cases
  • Store responses to similar requests within the memory database (such asRedis) to guarantee fast retrieval when new requests come in
  • When requests hit the cache consider making an external request in the background to validate accuracy and update the cache with new information if required
  • Analyze your cache hit and miss ratio and frequency of response changes for the same requests

In action, these steps look like the following:

Input

Output

  • Assuming that for a given origin and destination pair ofpostal_codesand a given total weight, every request returns identical shipping rates
  • Based on this assumption the following cache pattern and key can be created:
#{carrier_name}_#{origin_postal_code}_#{destination_postal_code}_#{total_items_weight} => shopify_post_C3C3C3_K2K2K2_1

3. Parallelize calls to external systems

If calls to external systems such as carriers cannot be avoided through local storage of public retail rates or caching, you can reduce the response time of your shipping app by calling carriers in parallel. Parallelization in combination with a timeout for slow carriers can be very effective in speeding up your response to Shopify while ensuring checkouts are not blocked as a subset of rates are returned.

4. Set timeouts for external systems

If your shipping app fetches rates from multiple external systems and you are parallelizing these calls, your app’s response time to Shopify will be at least as long as the slowest response time. To avoid a timeout and a blocked checkout on Shopify's side, we recommend setting an internal timeout that cancels your request to the external system if it fails to respond. Following this approach, you'll be able to return to Shopify a subset of rates and unblock checkout.

5. Optimize the hosting of your service

The response time of your shipping app matters due to the impact it has on customers’ experience at checkout and, therefore, on merchants’ success. A share of the response time can be attributed to the latency between your app server and Shopify servers, which is particularly large when both are located on different continents.

To understand the impact of server hosting on your response time, follow the below steps:

1. Create new file calledcurl-format.txt与内容:
    2. Usecurl -w "@curl-format.txt" -o /dev/null -s "http://url/"where the URL is the address of one of the Shopify stores your application is installed on. Repeat this step with stores that are located in different regions.

      Example output:

      Find additional details incurl's documentation.

      The impact of latency varies greatly between regions. Shopify servers are hosted on Google Cloud, for which different levels of latency by region apply as specified in theGoogle Cloud inter-region latency matrix.

      Recommended steps

      If your connection time is significantly higher than the Google Cloud inter-region latency, consider following the following actions:

      • Change your hosting provider to Google Cloud to take advantage of an optimized infrastructure
      • Move your application to a region closer to the majority of Shopify stores using your application

      6. Implement backup rates

      To mitigate the risk of blocked checkouts generally and in case of timeouts for external partners specifically, we recommend implementing a backup system for your shipping app (seeShopify backup rates). These rates should be stored in such a way that you can quickly fetch them when external partner requests fail to ensure a successful response to Shopify.

      Backup rates don't need match rates fetched from external sources exactly, but should be sufficiently close to not significantly impact merchants’ profitability and conversion. By analyzing the response data your app is getting from external sources, you should be able to create such relevant rates for your merchants.

      Recommended steps

      • Define the high-level logic for your backup rates. We recommend keeping things simple: one expensive and fast and one cheap and slow shipping rate per zone (country, city), weight, or size can be sufficient.
      • Analyze the response data from your external sources to create relevant backup rates that help you avoid blocked checkouts without impacting merchants’ business negatively.
      • Store the backup rates in an easily accessible datastore to return them quickly when an external service is unresponsive within the expected timeframe (< 500ms).
      • 为商人Shopify备份速度,实现ing backup rates specific to your application will likely result in a better merchant and customer experience.

      Find below an example of backup rates for domestic orders in Canada. Rates differ based on order weight only, but are independent of the specific origin or destination zip code.

      Dependency on multiple requests to Shopify

      We're aware that in many cases applications may require information from Shopify that is not included in the Carrier Service API payload to calculate accurate shipping rates (such as customer or product tags).

      We would appreciate your feedback on what information is missing in the current payload that requires your app to make multiple calls to Shopify to calculate accurate shipping rates. You can provide your answer usingthis Google Form.

      By optimizing your shipping app for performance at checkout, you’re helping merchants boost conversion and make more sales—creating happier and more loyal users for you.

      Grow your business with the Shopify Partner Program

      Learn more