--- title: useDeliveryGroups description: >- Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes. api_version: 2023-04 api_name: checkout-ui-extensions source_url: html: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-04/react-hooks/delivery/usedeliverygroups md: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-04/react-hooks/delivery/usedeliverygroups.md --- # use​Delivery​Groups Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes. ## use​Delivery​Groups() ### Returns * DeliveryGroup\[] ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. * targetedCartLines The cart line references associated to the delivery group. ```ts CartLineReference[] ``` * deliveryOptions The delivery options available for the delivery group. ```ts DeliveryOption[] ``` * selectedDeliveryOption The selected delivery option for the delivery group. ```ts DeliveryOptionReference ``` * groupType The type of the delivery group. ```ts DeliveryGroupType ``` * isDeliveryRequired Whether delivery is required for the delivery group. ```ts boolean ``` ```ts export interface DeliveryGroup { /** * The cart line references associated to the delivery group. */ targetedCartLines: CartLineReference[]; /** * The delivery options available for the delivery group. */ deliveryOptions: DeliveryOption[]; /** * The selected delivery option for the delivery group. */ selectedDeliveryOption?: DeliveryOptionReference; /** * The type of the delivery group. */ groupType: DeliveryGroupType; /** * Whether delivery is required for the delivery group. */ isDeliveryRequired: boolean; } ``` ### CartLineReference Represents a reference to a cart line. * id The unique identifier of the referenced cart line. ```ts string ``` ```ts export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } ``` ### DeliveryOption Represents a base interface for a single delivery option. * handle The unique identifier of the delivery option. ```ts string ``` * title The title of the delivery option. ```ts string ``` * description The description of the delivery option. ```ts string ``` ```ts export interface DeliveryOption { /** * The unique identifier of the delivery option. */ handle: string; /** * The title of the delivery option. */ title?: string; /** * The description of the delivery option. */ description?: string; } ``` ### DeliveryOptionReference Represents a reference to a delivery option. * handle The unique identifier of the referenced delivery option. ```ts string ``` ```ts export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } ``` ### DeliveryGroupType The possible types of a delivery group. ```ts 'oneTimePurchase' | 'subscription' ``` Examples ### Examples * #### Delivery groups ##### React ```jsx import React from 'react'; import { render, Banner, useDeliveryGroups, } from '@shopify/checkout-ui-extensions-react'; render('Checkout::Dynamic::Render', () => ( )); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## Related [APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi) [APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi) [APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi) [APIs - CartLineDetailsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlinedetailsapi) [APIs - PickupPointsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointsapi) [APIs - PickupLocationsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationsapi) [APIs - ShippingMethodDetailsApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingmethoddetailsapi) [APIs - ExtensionPoints](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensionpoints)