Skip to main content

Preload checkout

Preloading fetches checkout in the background. When the buyer taps Checkout, checkout is already loaded and opens with no delay.

Without preload
With preload


When the buyer navigates to the cart, call preload() to start fetching checkout in the background. By the time they tap Checkout, the page is ready:

Preload checkout

ShopifyCheckoutSheetKit.preload(checkout: checkoutURL)
ShopifyCheckoutSheetKit.preload(checkoutUrl, context)
// using hooks
const shopifyCheckout = useShopifyCheckoutSheet();
shopifyCheckout.preload(checkoutUrl);

// using a class instance
const shopifyCheckout = new ShopifyCheckoutSheet();
shopifyCheckout.preload(checkoutUrl);
Caution

Avoid calling preload() on every add-to-cart action. Frequent preloading triggers background network requests, increases memory usage, and might trigger Storefront API rate limits.


Anchor to Manage preloaded checkoutsManage preloaded checkouts

Preloading renders checkout in a background WebView. The preloaded checkout reflects the cart at the time you call preload(). When you call ShopifyCheckoutSheetKit.present(), the checkout moves to the foreground.

If the cart changes after preloading, call preload() again to refresh, or call ShopifyCheckoutSheetKit.invalidate() to clear the cache. Closing checkout doesn't automatically invalidate preloaded content, so update it when the buyer modifies their cart.

Checkout Kit might delay or skip preloading during high traffic. If preloading doesn't complete before you call present(checkoutUrl), then buyers see a loading state.


To disable preloading, set enabled to false. You might disable it when a buyer enables data saver mode. When disabled, Checkout Kit ignores all calls to preload():

Disable preloading

ShopifyCheckoutSheetKit.configure {
$0.preloading.enabled = false // defaults to true
}
ShopifyCheckoutSheetKit.configure {
it.preloading = Preloading(enabled = false) // defaults to true
}
import { ShopifyCheckoutSheetProvider } from '@shopify/checkout-sheet-kit';

const configuration = { preloading: false };

<ShopifyCheckoutSheetProvider configuration={configuration}>
<App />
</ShopifyCheckoutSheetProvider>


Was this page helpful?