Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes.
import {
reactExtension,
Banner,
useDeliveryGroups,
} from '@shopify/ui-extensions-react/checkout';
export default reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);
function Extension() {
const deliveryGroups = useDeliveryGroups();
const deliveryOptions =
deliveryGroups[0].deliveryOptions;
return (
<Banner>
First delivery option:{' '}
{deliveryOptions[0].title}
</Banner>
);
}
Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes.
export function useDeliveryGroups< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): DeliveryGroup[] { const api = useApi<Target>(); if (!('deliveryGroups' in api)) { throw new ExtensionHasNoMethodError('deliveryGroups', api.extension.target); } return useSubscription(api.deliveryGroups); }
Represents the delivery information and options available for one or more cart lines.
The cart line references associated to the delivery group.
The delivery options available for the delivery group.
The selected delivery option for the delivery group.
The type of the delivery group.
Whether delivery is required for the delivery group.
Represents a reference to a cart line.
The unique identifier of the referenced cart line.
Represents a base interface for a single delivery option.
The unique identifier of the delivery option.
The title of the delivery option.
The description of the delivery option.
Represents a reference to a delivery option.
The unique identifier of the referenced delivery option.
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'