Skip to main content

useSubscription()

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.

Note

> As of version 2025-10, you no longer need this hook. When you access .value > (instead of .current) on subscribable properties, Preact will automatically > re-render as .value changes.

Anchor to subscription
subscription
<Value>
required

Value
Examples

Preact

import '@shopify/ui-extensions/preact';
import {render} from 'preact';

export default function extension() {
render(<Extension />, document.body);
}

function Extension() {
// As of version 2025-10, you no longer need the `useSubscription` hook.
// When you access `.value` on subscribable properties,
// Preact will automatically re-render as `.value` changes.
return (
<s-banner>
{shopify.cost.totalAmount.value.amount}
</s-banner>
);
}
Was this page helpful?