Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.
use Subscription()
Subscribes to the special wrapper type that all “changeable” values in the checkout use. This hook extracts the most recent value from that object, and subscribes to update the value when changes occur in the checkout.
> You generally shouldn’t need to use this directly, as there are dedicated hooks > for accessing the current value of each individual resource in the checkout.
> You generally shouldn’t need to use this directly, as there are dedicated hooks > for accessing the current value of each individual resource in the checkout.
Note: > You generally shouldn’t need to use this directly, as there are dedicated hooks > for accessing the current value of each individual resource in the checkout.
Anchor to useSubscription-parametersParameters
- Anchor to subscriptionsubscriptionsubscriptionStatefulRemoteSubscribable<Value>StatefulRemoteSubscribable<Value>requiredrequired
React
Examples
Subscribing to changes
React
import { reactExtension, Banner, useApi, useSubscription, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => <Extension />, ); function Extension() { const {cost} = useApi(); // Equivalent to the useTotalAmount() hook to subscribe and re-render your extension on changes const totalAmount = useSubscription( cost.totalAmount, ); return <Banner>{totalAmount.amount}</Banner>; }