Storage API
The Storage API provides key-value storage that persists across page loads within the current checkout session. Use this API to save and restore extension state, such as dismissed banners, form progress, or buyer preferences, so that the buyer doesn't lose context when navigating between checkout steps.
Storage is scoped to your extension. Other extensions can't read or write your stored data.
Anchor to Use casesUse cases
- Persist dismissed banners: Save whether the buyer has dismissed a promotional banner so it stays hidden when they navigate back.
- Restore form state: Store partially completed form data so that the buyer doesn't have to re-enter it after navigating away and returning.
- Track extension state: Save flags or counters that your extension needs to maintain across page loads within the checkout.
Supported targets
- purchase.
address-autocomplete. format-suggestion - purchase.
address-autocomplete. suggest - purchase.
checkout. actions. render-before - purchase.
checkout. block. render - purchase.
checkout. cart-line-item. render-after - purchase.
checkout. cart-line-list. render-after - purchase.
checkout. chat. render - purchase.
checkout. contact. render-after - purchase.
checkout. delivery-address. render-after - purchase.
checkout. delivery-address. render-before - purchase.
checkout. footer. render-after - purchase.
checkout. header. render-after - purchase.
checkout. payment-method-list. render-after - purchase.
checkout. payment-method-list. render-before - purchase.
checkout. pickup-location-list. render-after - purchase.
checkout. pickup-location-list. render-before - purchase.
checkout. pickup-location-option-item. render-after - purchase.
checkout. pickup-point-list. render-after - purchase.
checkout. pickup-point-list. render-before - purchase.
checkout. reductions. render-after - purchase.
checkout. reductions. render-before - purchase.
checkout. shipping-option-item. details. render - purchase.
checkout. shipping-option-item. render-after - purchase.
checkout. shipping-option-list. render-after - purchase.
checkout. shipping-option-list. render-before - purchase.
thank-you. announcement. render - purchase.
thank-you. block. render - purchase.
thank-you. cart-line-item. render-after - purchase.
thank-you. cart-line-list. render-after - purchase.
thank-you. chat. render - purchase.
thank-you. customer-information. render-after - purchase.
thank-you. footer. render-after - purchase.
thank-you. header. render-after
Supported targets
- purchase.
address-autocomplete. format-suggestion - purchase.
address-autocomplete. suggest - purchase.
checkout. actions. render-before - purchase.
checkout. block. render - purchase.
checkout. cart-line-item. render-after - purchase.
checkout. cart-line-list. render-after - purchase.
checkout. chat. render - purchase.
checkout. contact. render-after - purchase.
checkout. delivery-address. render-after - purchase.
checkout. delivery-address. render-before - purchase.
checkout. footer. render-after - purchase.
checkout. header. render-after - purchase.
checkout. payment-method-list. render-after - purchase.
checkout. payment-method-list. render-before - purchase.
checkout. pickup-location-list. render-after - purchase.
checkout. pickup-location-list. render-before - purchase.
checkout. pickup-location-option-item. render-after - purchase.
checkout. pickup-point-list. render-after - purchase.
checkout. pickup-point-list. render-before - purchase.
checkout. reductions. render-after - purchase.
checkout. reductions. render-before - purchase.
checkout. shipping-option-item. details. render - purchase.
checkout. shipping-option-item. render-after - purchase.
checkout. shipping-option-list. render-after - purchase.
checkout. shipping-option-list. render-before - purchase.
thank-you. announcement. render - purchase.
thank-you. block. render - purchase.
thank-you. cart-line-item. render-after - purchase.
thank-you. cart-line-list. render-after - purchase.
thank-you. chat. render - purchase.
thank-you. customer-information. render-after - purchase.
thank-you. footer. render-after - purchase.
thank-you. header. render-after
Anchor to Properties and methodsProperties and methods
The shopify global object provides session storage for the current checkout. Access the following properties and methods on shopify to read, write, and delete stored values. Available to purchase extension targets.
- Anchor to storagestoragestorageStorageStoragerequiredrequired
Key-value storage that persists across page loads within the current checkout session. Data is shared across all activated targets associated with this extension.
CautionData persistence isn't guaranteed and storage is cleared when the buyer starts a new checkout.
Caution:Data persistence isn't guaranteed and storage is cleared when the buyer starts a new checkout.
Caution: Data persistence isn't guaranteed and storage is cleared when the buyer starts a new checkout.
Storage
Key-value storage for a specific extension. Use storage to save preferences or cached data that should survive page reloads without requiring a backend call. Stored data is only available to this specific extension. The storage backend is implemented with `localStorage` and data persistence isn't guaranteed.
- delete
Deletes a previously stored value by key.
(key: string) => Promise<void> - read
Read and return a stored value by key. The stored data is deserialized from JSON and returned as its original type. Returns the stored value for the given key, or `null` when no value exists. Doesn't throw on a missing key.
<T = unknown>(key: string) => Promise<T> - write
Write stored data for this key. The data must be serializable to JSON.
(key: string, data: any) => Promise<void>
Anchor to Best practicesBest practices
- Store only small, serializable values: Storage uses
localStorageunder the hood. Keep stored data small and JSON-serializable to avoid unexpected behavior. - Use
delete()instead of writing empty values: To remove a stored entry, callstorage.delete(key)rather than writingnullor an empty string. This keeps your storage clean and avoids ambiguity when checking for missing keys.
Anchor to LimitationsLimitations
- Stored data persists only for the current checkout session. After checkout completes or the session expires, all stored values are cleared. Data persistence within a session isn't guaranteed, so don't rely on storage for critical checkout states.