# Delivery The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Banner, useDeliveryGroups, useDeliveryGroup, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const { selectedDeliveryOption, targetedCartLines, } = useDeliveryGroup(deliveryGroups[0]); return ( Selected delivery option:{' '} {selectedDeliveryOption?.title} ); } ``` ## StandardApi The base API object provided to `purchase`, and `customer-account.order-status` extension targets. ### Docs_Standard_DeliveryApi ### deliveryGroups value: `StatefulRemoteSubscribable` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } A list of delivery groups containing information about the delivery of the items the customer intends to purchase. ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### targetedCartLines value: `CartLineReference[]` - CartLineReference: export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } The cart line references associated to the delivery group. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### selectedDeliveryOption value: `DeliveryOptionReference` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption - DeliveryOptionReference: export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } The selected delivery option for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLineReference Represents a reference to a cart line. ### id value: `string` The unique identifier of the referenced cart line. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ### PickupPointOption ### type value: `"pickupPoint"` The type of this delivery option. ### carrier value: `PickupPointCarrier` - PickupPointCarrier: interface PickupPointCarrier { /** * The code identifying the carrier. */ code?: string; /** * The name of the carrier. */ name?: string; } Information about the carrier that ships to the pickup point. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point including discounts. ### location value: `PickupPointLocation` - PickupPointLocation: interface PickupPointLocation { /** * The name of the pickup point. */ name?: string; /** * The unique identifier of the pickup point. */ handle: string; /** * The address of the pickup point. */ address: MailingAddress; } The location details of the pickup point. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupPointCarrier ### code value: `string` The code identifying the carrier. ### name value: `string` The name of the carrier. ### PickupPointLocation ### name value: `string` The name of the pickup point. ### handle value: `string` The unique identifier of the pickup point. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup point. ### MailingAddress ### name value: `string` The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### firstName value: `string` The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### lastName value: `string` The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### company value: `string` The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address1 value: `string` The first line of the buyer's address, including street name and number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address2 value: `string` The second line of the buyer's address, like apartment number, suite, etc. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### city value: `string` The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### zip value: `string` The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### countryCode value: `CountryCode` - CountryCode: 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AR' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PS' | 'PT' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'ZZ' The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### provinceCode value: `string` The buyer's province code, such as state, province, prefecture, or region. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### phone value: `string` The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### PickupLocationOption ### type value: `"pickup"` The type of this delivery option. ### location value: `PickupLocation` - PickupLocation: interface PickupLocation { /** * The name of the pickup location. */ name?: string; /** * The address of the pickup location. */ address: MailingAddress; } The location details of the pickup location. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupLocation ### name value: `string` The name of the pickup location. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup location. ### DeliveryOptionReference Represents a reference to a delivery option. ### handle value: `string` The unique identifier of the referenced delivery option. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## useDeliveryGroup Returns the full expanded details of a delivery group and automatically re-renders your component when that delivery group changes. ### UseDeliveryGroupGeneratedType Returns the full expanded details of a delivery group and automatically re-renders your component when that delivery group changes. #### Returns: DeliveryGroupDetails #### Params: - deliveryGroup: DeliveryGroup export function useDeliveryGroup< ID extends RenderExtensionTarget = RenderExtensionTarget, >(deliveryGroup: DeliveryGroup): DeliveryGroupDetails { const {lines} = useApi(); const cartLines = useSubscription(lines); return useMemo(() => { if (!deliveryGroup) { throw new DeliveryGroupHookError( 'useDeliveryGroup must be called with a delivery group from the useDeliveryGroups hook', ); } const deliveryGroupDetails = { ...deliveryGroup, selectedDeliveryOption: getSelectedDeliveryOption(deliveryGroup), targetedCartLines: getTargetedCartLines(deliveryGroup, cartLines), }; return deliveryGroupDetails; }, [deliveryGroup, cartLines]); } ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### targetedCartLines value: `CartLineReference[]` - CartLineReference: export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } - CartLine: export interface CartLine { /** * These line item IDs are not stable at the moment, they might change after * any operations on the line items. You should always look up for an updated * ID before any call to `applyCartLinesChange` because you'll need the ID to * create a `CartLineChange` object. * @example 'gid://shopify/CartLine/123' */ id: string; /** * The merchandise being purchased. */ merchandise: Merchandise; /** * The quantity of the merchandise being purchased. */ quantity: number; /** * The details about the cost components attributed to the cart line. */ cost: CartLineCost; /** * The line item additional custom attributes. */ attributes: Attribute[]; /** * Discounts applied to the cart line. */ discountAllocations: CartDiscountAllocation[]; /** * Sub lines of the merchandise line. If no sub lines are present, this will be an empty array. */ lineComponents: CartLineComponentType[]; } The cart line references associated to the delivery group. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### selectedDeliveryOption value: `DeliveryOptionReference` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption - DeliveryOptionReference: export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } The selected delivery option for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLineReference Represents a reference to a cart line. ### id value: `string` The unique identifier of the referenced cart line. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ### PickupPointOption ### type value: `"pickupPoint"` The type of this delivery option. ### carrier value: `PickupPointCarrier` - PickupPointCarrier: interface PickupPointCarrier { /** * The code identifying the carrier. */ code?: string; /** * The name of the carrier. */ name?: string; } Information about the carrier that ships to the pickup point. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point including discounts. ### location value: `PickupPointLocation` - PickupPointLocation: interface PickupPointLocation { /** * The name of the pickup point. */ name?: string; /** * The unique identifier of the pickup point. */ handle: string; /** * The address of the pickup point. */ address: MailingAddress; } The location details of the pickup point. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupPointCarrier ### code value: `string` The code identifying the carrier. ### name value: `string` The name of the carrier. ### PickupPointLocation ### name value: `string` The name of the pickup point. ### handle value: `string` The unique identifier of the pickup point. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup point. ### MailingAddress ### name value: `string` The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### firstName value: `string` The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### lastName value: `string` The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### company value: `string` The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address1 value: `string` The first line of the buyer's address, including street name and number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address2 value: `string` The second line of the buyer's address, like apartment number, suite, etc. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### city value: `string` The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### zip value: `string` The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### countryCode value: `CountryCode` - CountryCode: 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AR' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PS' | 'PT' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'ZZ' The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### provinceCode value: `string` The buyer's province code, such as state, province, prefecture, or region. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### phone value: `string` The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### PickupLocationOption ### type value: `"pickup"` The type of this delivery option. ### location value: `PickupLocation` - PickupLocation: interface PickupLocation { /** * The name of the pickup location. */ name?: string; /** * The address of the pickup location. */ address: MailingAddress; } The location details of the pickup location. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupLocation ### name value: `string` The name of the pickup location. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup location. ### DeliveryOptionReference Represents a reference to a delivery option. ### handle value: `string` The unique identifier of the referenced delivery option. ### DeliveryGroupDetails Represents a DeliveryGroup with expanded reference fields and full details. ### selectedDeliveryOption value: `DeliveryOption` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The selected delivery option for the delivery group. ### targetedCartLines value: `CartLine[]` - CartLine: export interface CartLine { /** * These line item IDs are not stable at the moment, they might change after * any operations on the line items. You should always look up for an updated * ID before any call to `applyCartLinesChange` because you'll need the ID to * create a `CartLineChange` object. * @example 'gid://shopify/CartLine/123' */ id: string; /** * The merchandise being purchased. */ merchandise: Merchandise; /** * The quantity of the merchandise being purchased. */ quantity: number; /** * The details about the cost components attributed to the cart line. */ cost: CartLineCost; /** * The line item additional custom attributes. */ attributes: Attribute[]; /** * Discounts applied to the cart line. */ discountAllocations: CartDiscountAllocation[]; /** * Sub lines of the merchandise line. If no sub lines are present, this will be an empty array. */ lineComponents: CartLineComponentType[]; } The cart lines associated to the delivery group. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLine ### id value: `string` These line item IDs are not stable at the moment, they might change after any operations on the line items. You should always look up for an updated ID before any call to `applyCartLinesChange` because you'll need the ID to create a `CartLineChange` object. ### merchandise value: `Merchandise` - Merchandise: ProductVariant The merchandise being purchased. ### quantity value: `number` The quantity of the merchandise being purchased. ### cost value: `CartLineCost` - CartLine: export interface CartLine { /** * These line item IDs are not stable at the moment, they might change after * any operations on the line items. You should always look up for an updated * ID before any call to `applyCartLinesChange` because you'll need the ID to * create a `CartLineChange` object. * @example 'gid://shopify/CartLine/123' */ id: string; /** * The merchandise being purchased. */ merchandise: Merchandise; /** * The quantity of the merchandise being purchased. */ quantity: number; /** * The details about the cost components attributed to the cart line. */ cost: CartLineCost; /** * The line item additional custom attributes. */ attributes: Attribute[]; /** * Discounts applied to the cart line. */ discountAllocations: CartDiscountAllocation[]; /** * Sub lines of the merchandise line. If no sub lines are present, this will be an empty array. */ lineComponents: CartLineComponentType[]; } - CartLineCost: export interface CartLineCost { /** * The total amount after reductions the buyer can expect to pay that is directly attributable to a single * cart line. */ totalAmount: Money; } The details about the cost components attributed to the cart line. ### attributes value: `Attribute[]` - Attribute: export interface Attribute { /** * The key for the attribute. */ key: string; /** * The value for the attribute. */ value: string; } The line item additional custom attributes. ### discountAllocations value: `CartDiscountAllocation[]` - CartDiscountAllocation: CartCodeDiscountAllocation | CartAutomaticDiscountAllocation | CartCustomDiscountAllocation Discounts applied to the cart line. ### lineComponents value: `CartBundleLineComponent[]` - CartBundleLineComponent: export interface CartBundleLineComponent { type: 'bundle'; /** * A unique identifier for the bundle line component. * * This ID is not stable. If an operation updates the line items in any way, all IDs could change. * * @example 'gid://shopify/CartLineComponent/123' */ id: string; /** * The merchandise of this bundle line component. */ merchandise: Merchandise; /** * The quantity of merchandise being purchased. */ quantity: number; /** * The cost attributed to this bundle line component. */ cost: CartLineCost; /** * Additional custom attributes for the bundle line component. * * @example [{key: 'engraving', value: 'hello world'}] */ attributes: Attribute[]; } Sub lines of the merchandise line. If no sub lines are present, this will be an empty array. ### Merchandise ### type value: `"variant"` ### id value: `string` A globally-unique identifier. ### title value: `string` The product variant’s title. ### subtitle value: `string` The product variant's subtitle. ### image value: `ImageDetails` - ImageDetails: export interface ImageDetails { /** * The image URL. */ url: string; /** * The alternative text for the image. */ altText?: string; } Image associated with the product variant. This field falls back to the product image if no image is available. ### selectedOptions value: `SelectedOption[]` - SelectedOption: export interface SelectedOption { /** * The name of the merchandise option. */ name: string; /** * The value of the merchandise option. */ value: string; } List of product options applied to the variant. ### product value: `Product` - Product: export interface Product { /** * A globally-unique identifier. */ id: string; /** * The product’s vendor name. */ vendor: string; /** * A categorization that a product can be tagged with, commonly used for filtering and searching. */ productType: string; } The product object that the product variant belongs to. ### requiresShipping value: `boolean` Whether or not the product requires shipping. ### sellingPlan value: `SellingPlan` - SellingPlan: export interface SellingPlan { /** * A globally-unique identifier. * @example 'gid://shopify/SellingPlan/1' */ id: string; } The selling plan associated with the merchandise. ### ImageDetails ### url value: `string` The image URL. ### altText value: `string` The alternative text for the image. ### SelectedOption ### name value: `string` The name of the merchandise option. ### value value: `string` The value of the merchandise option. ### Product ### id value: `string` A globally-unique identifier. ### vendor value: `string` The product’s vendor name. ### productType value: `string` A categorization that a product can be tagged with, commonly used for filtering and searching. ### SellingPlan ### id value: `string` A globally-unique identifier. ### CartLineCost ### totalAmount value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The total amount after reductions the buyer can expect to pay that is directly attributable to a single cart line. ### Attribute ### key value: `string` The key for the attribute. ### value value: `string` The value for the attribute. ### CartCodeDiscountAllocation ### code value: `string` The code for the discount ### type value: `"code"` The type of the code discount ### discountedAmount value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The money amount that has been discounted from the order ### CartAutomaticDiscountAllocation ### title value: `string` The title of the automatic discount ### type value: `"automatic"` The type of the automatic discount ### discountedAmount value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The money amount that has been discounted from the order ### CartCustomDiscountAllocation ### title value: `string` The title of the custom discount ### type value: `"custom"` The type of the custom discount ### discountedAmount value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The money amount that has been discounted from the order ### CartBundleLineComponent ### type value: `"bundle"` ### id value: `string` A unique identifier for the bundle line component. This ID is not stable. If an operation updates the line items in any way, all IDs could change. ### merchandise value: `Merchandise` - Merchandise: ProductVariant The merchandise of this bundle line component. ### quantity value: `number` The quantity of merchandise being purchased. ### cost value: `CartLineCost` - CartLine: export interface CartLine { /** * These line item IDs are not stable at the moment, they might change after * any operations on the line items. You should always look up for an updated * ID before any call to `applyCartLinesChange` because you'll need the ID to * create a `CartLineChange` object. * @example 'gid://shopify/CartLine/123' */ id: string; /** * The merchandise being purchased. */ merchandise: Merchandise; /** * The quantity of the merchandise being purchased. */ quantity: number; /** * The details about the cost components attributed to the cart line. */ cost: CartLineCost; /** * The line item additional custom attributes. */ attributes: Attribute[]; /** * Discounts applied to the cart line. */ discountAllocations: CartDiscountAllocation[]; /** * Sub lines of the merchandise line. If no sub lines are present, this will be an empty array. */ lineComponents: CartLineComponentType[]; } - CartLineCost: export interface CartLineCost { /** * The total amount after reductions the buyer can expect to pay that is directly attributable to a single * cart line. */ totalAmount: Money; } The cost attributed to this bundle line component. ### attributes value: `Attribute[]` - Attribute: export interface Attribute { /** * The key for the attribute. */ key: string; /** * The value for the attribute. */ value: string; } Additional custom attributes for the bundle line component. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## useDeliveryGroups Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes. ### UseDeliveryGroupsGeneratedType Returns the current delivery groups for the checkout, and automatically re-renders your component when delivery address or delivery option selection changes. #### Returns: DeliveryGroup[] export function useDeliveryGroups< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): DeliveryGroup[] { const api = useApi(); if (!('deliveryGroups' in api)) { throw new ExtensionHasNoMethodError('deliveryGroups', api.extension.target); } return useSubscription(api.deliveryGroups); } ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### targetedCartLines value: `CartLineReference[]` - CartLineReference: export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } The cart line references associated to the delivery group. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### selectedDeliveryOption value: `DeliveryOptionReference` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption - DeliveryOptionReference: export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } The selected delivery option for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLineReference Represents a reference to a cart line. ### id value: `string` The unique identifier of the referenced cart line. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ### PickupPointOption ### type value: `"pickupPoint"` The type of this delivery option. ### carrier value: `PickupPointCarrier` - PickupPointCarrier: interface PickupPointCarrier { /** * The code identifying the carrier. */ code?: string; /** * The name of the carrier. */ name?: string; } Information about the carrier that ships to the pickup point. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point including discounts. ### location value: `PickupPointLocation` - PickupPointLocation: interface PickupPointLocation { /** * The name of the pickup point. */ name?: string; /** * The unique identifier of the pickup point. */ handle: string; /** * The address of the pickup point. */ address: MailingAddress; } The location details of the pickup point. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupPointCarrier ### code value: `string` The code identifying the carrier. ### name value: `string` The name of the carrier. ### PickupPointLocation ### name value: `string` The name of the pickup point. ### handle value: `string` The unique identifier of the pickup point. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup point. ### MailingAddress ### name value: `string` The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### firstName value: `string` The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### lastName value: `string` The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### company value: `string` The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address1 value: `string` The first line of the buyer's address, including street name and number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address2 value: `string` The second line of the buyer's address, like apartment number, suite, etc. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### city value: `string` The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### zip value: `string` The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### countryCode value: `CountryCode` - CountryCode: 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AR' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PS' | 'PT' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'ZZ' The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### provinceCode value: `string` The buyer's province code, such as state, province, prefecture, or region. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### phone value: `string` The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### PickupLocationOption ### type value: `"pickup"` The type of this delivery option. ### location value: `PickupLocation` - PickupLocation: interface PickupLocation { /** * The name of the pickup location. */ name?: string; /** * The address of the pickup location. */ address: MailingAddress; } The location details of the pickup location. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupLocation ### name value: `string` The name of the pickup location. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup location. ### DeliveryOptionReference Represents a reference to a delivery option. ### handle value: `string` The unique identifier of the referenced delivery option. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## Shipping Option This API object is provided to extensions registered for the `purchase.checkout.shipping-option-item.render-after` and `purchase.checkout.shipping-option-item.details.render` extension targets. ### ShippingOptionItemApi ### target value: `StatefulRemoteSubscribable` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } The shipping option the extension is attached to. ### isTargetSelected value: `StatefulRemoteSubscribable` Whether the shipping option the extension is attached to is currently selected in the UI. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## useShippingOptionTarget Returns the shipping option for the `purchase.checkout.shipping-option-item.render-after` and `purchase.checkout.shipping-option-item.details.render` attached extensions ### UseShippingOptionTargetGeneratedType Returns the shipping option the extension is attached to. This hook can only be used by extensions in the following extension targets: - `purchase.checkout.shipping-option-item.render-after` - `purchase.checkout.shipping-option-item.details.render` #### Returns: { shippingOptionTarget: ShippingOption; isTargetSelected: boolean; } export function useShippingOptionTarget(): { shippingOptionTarget: ShippingOption; isTargetSelected: boolean; } { const api = useApi< | 'purchase.checkout.shipping-option-item.render-after' | 'purchase.checkout.shipping-option-item.details.render' >(); if (!api.target || api.isTargetSelected === undefined) { throw new ExtensionHasNoTargetError( 'useShippingOptionTarget', api.extension.target, ); } const shippingOptionTarget = useSubscription(api.target); const isTargetSelected = useSubscription(api.isTargetSelected); const shippingOption = useMemo(() => { return { shippingOptionTarget, isTargetSelected, }; }, [shippingOptionTarget, isTargetSelected]); return shippingOption; } ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## ShippingOptionListApi This API object is provided to extensions registered for the `purchase.checkout.shipping-option-list.render-before` and `purchase.checkout.shipping-option-list.render-after` extension targets. ### ShippingOptionListApi ### target value: `StatefulRemoteSubscribable` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } The delivery group the extension is attached to. The target will be undefined if the group is not available. ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### targetedCartLines value: `CartLineReference[]` - CartLineReference: export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } The cart line references associated to the delivery group. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### selectedDeliveryOption value: `DeliveryOptionReference` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption - DeliveryOptionReference: export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } The selected delivery option for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLineReference Represents a reference to a cart line. ### id value: `string` The unique identifier of the referenced cart line. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ### PickupPointOption ### type value: `"pickupPoint"` The type of this delivery option. ### carrier value: `PickupPointCarrier` - PickupPointCarrier: interface PickupPointCarrier { /** * The code identifying the carrier. */ code?: string; /** * The name of the carrier. */ name?: string; } Information about the carrier that ships to the pickup point. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point including discounts. ### location value: `PickupPointLocation` - PickupPointLocation: interface PickupPointLocation { /** * The name of the pickup point. */ name?: string; /** * The unique identifier of the pickup point. */ handle: string; /** * The address of the pickup point. */ address: MailingAddress; } The location details of the pickup point. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupPointCarrier ### code value: `string` The code identifying the carrier. ### name value: `string` The name of the carrier. ### PickupPointLocation ### name value: `string` The name of the pickup point. ### handle value: `string` The unique identifier of the pickup point. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup point. ### MailingAddress ### name value: `string` The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### firstName value: `string` The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### lastName value: `string` The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### company value: `string` The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address1 value: `string` The first line of the buyer's address, including street name and number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address2 value: `string` The second line of the buyer's address, like apartment number, suite, etc. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### city value: `string` The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### zip value: `string` The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### countryCode value: `CountryCode` - CountryCode: 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AR' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PS' | 'PT' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'ZZ' The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### provinceCode value: `string` The buyer's province code, such as state, province, prefecture, or region. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### phone value: `string` The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### PickupLocationOption ### type value: `"pickup"` The type of this delivery option. ### location value: `PickupLocation` - PickupLocation: interface PickupLocation { /** * The name of the pickup location. */ name?: string; /** * The address of the pickup location. */ address: MailingAddress; } The location details of the pickup location. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupLocation ### name value: `string` The name of the pickup location. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup location. ### DeliveryOptionReference Represents a reference to a delivery option. ### handle value: `string` The unique identifier of the referenced delivery option. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## useDeliveryGroupTarget Returns the delivery group for the `purchase.checkout.shipping-option-list.render-before` and `purchase.checkout.shipping-option-list.render-after` attached extensions. ### UseDeliveryGroupTargetGeneratedType Returns the delivery group the extension is attached to. This hook can only be used by extensions in the following extension targets: - purchase.checkout.shipping-option-list.render-before - purchase.checkout.shipping-option-list.render-after #### Returns: DeliveryGroup | undefined export function useDeliveryGroupTarget(): DeliveryGroup | undefined { const api = useApi< | 'purchase.checkout.shipping-option-list.render-before' | 'purchase.checkout.shipping-option-list.render-after' >(); return useSubscription(api.target); } ### DeliveryGroup Represents the delivery information and options available for one or more cart lines. ### id value: `string` The unique identifier of the delivery group. On the Thank You page this value is undefined. ### targetedCartLines value: `CartLineReference[]` - CartLineReference: export interface CartLineReference { /** * The unique identifier of the referenced cart line. */ id: string; } The cart line references associated to the delivery group. ### deliveryOptions value: `DeliveryOption[]` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption The delivery options available for the delivery group. ### selectedDeliveryOption value: `DeliveryOptionReference` - DeliveryOption: ShippingOption | PickupPointOption | PickupLocationOption - DeliveryOptionReference: export interface DeliveryOptionReference { /** * The unique identifier of the referenced delivery option. */ handle: string; } The selected delivery option for the delivery group. ### groupType value: `DeliveryGroupType` - DeliveryGroup: export interface DeliveryGroup { /** * The unique identifier of the delivery group. On the Thank You page this value is undefined. */ id?: string; /** * 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; } - DeliveryGroupType: 'oneTimePurchase' | 'subscription' The type of the delivery group. ### isDeliveryRequired value: `boolean` Whether delivery is required for the delivery group. ### CartLineReference Represents a reference to a cart line. ### id value: `string` The unique identifier of the referenced cart line. ### ShippingOption Represents a delivery option that is a shipping option. ### type value: `"shipping" | "local"` The type of this delivery option. ### carrier value: `ShippingOptionCarrier` - ShippingOption: export interface ShippingOption extends DeliveryOptionBase { /** * The type of this delivery option. */ type: 'shipping' | 'local'; /** * Information about the carrier. */ carrier: ShippingOptionCarrier; /** * The cost of the delivery. */ cost: Money; /** * The cost of the delivery including discounts. */ costAfterDiscounts: Money; /** * Information about the estimated delivery time. */ deliveryEstimate: DeliveryEstimate; } - ShippingOptionCarrier: export interface ShippingOptionCarrier { /** * The name of the carrier. */ name?: string; } Information about the carrier. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost of the delivery including discounts. ### deliveryEstimate value: `DeliveryEstimate` - DeliveryEstimate: export interface DeliveryEstimate { /** * The estimated time in transit for the delivery in seconds. */ timeInTransit?: NumberRange; } Information about the estimated delivery time. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### ShippingOptionCarrier ### name value: `string` The name of the carrier. ### Money ### amount value: `number` The price amount. ### currencyCode value: `CurrencyCode` - CurrencyCode: 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' The ISO 4217 format for the currency. ### DeliveryEstimate ### timeInTransit value: `NumberRange` - NumberRange: export interface NumberRange { /** * The lower bound of the number range. */ lower?: number; /** * The upper bound of the number range. */ upper?: number; } The estimated time in transit for the delivery in seconds. ### NumberRange ### lower value: `number` The lower bound of the number range. ### upper value: `number` The upper bound of the number range. ### PickupPointOption ### type value: `"pickupPoint"` The type of this delivery option. ### carrier value: `PickupPointCarrier` - PickupPointCarrier: interface PickupPointCarrier { /** * The code identifying the carrier. */ code?: string; /** * The name of the carrier. */ name?: string; } Information about the carrier that ships to the pickup point. ### cost value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point. ### costAfterDiscounts value: `Money` - Money: export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } The cost to ship to this pickup point including discounts. ### location value: `PickupPointLocation` - PickupPointLocation: interface PickupPointLocation { /** * The name of the pickup point. */ name?: string; /** * The unique identifier of the pickup point. */ handle: string; /** * The address of the pickup point. */ address: MailingAddress; } The location details of the pickup point. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupPointCarrier ### code value: `string` The code identifying the carrier. ### name value: `string` The name of the carrier. ### PickupPointLocation ### name value: `string` The name of the pickup point. ### handle value: `string` The unique identifier of the pickup point. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup point. ### MailingAddress ### name value: `string` The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### firstName value: `string` The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### lastName value: `string` The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### company value: `string` The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address1 value: `string` The first line of the buyer's address, including street name and number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### address2 value: `string` The second line of the buyer's address, like apartment number, suite, etc. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### city value: `string` The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### zip value: `string` The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### countryCode value: `CountryCode` - CountryCode: 'AC' | 'AD' | 'AE' | 'AF' | 'AG' | 'AI' | 'AL' | 'AM' | 'AN' | 'AO' | 'AR' | 'AT' | 'AU' | 'AW' | 'AX' | 'AZ' | 'BA' | 'BB' | 'BD' | 'BE' | 'BF' | 'BG' | 'BH' | 'BI' | 'BJ' | 'BL' | 'BM' | 'BN' | 'BO' | 'BQ' | 'BR' | 'BS' | 'BT' | 'BV' | 'BW' | 'BY' | 'BZ' | 'CA' | 'CC' | 'CD' | 'CF' | 'CG' | 'CH' | 'CI' | 'CK' | 'CL' | 'CM' | 'CN' | 'CO' | 'CR' | 'CU' | 'CV' | 'CW' | 'CX' | 'CY' | 'CZ' | 'DE' | 'DJ' | 'DK' | 'DM' | 'DO' | 'DZ' | 'EC' | 'EE' | 'EG' | 'EH' | 'ER' | 'ES' | 'ET' | 'FI' | 'FJ' | 'FK' | 'FO' | 'FR' | 'GA' | 'GB' | 'GD' | 'GE' | 'GF' | 'GG' | 'GH' | 'GI' | 'GL' | 'GM' | 'GN' | 'GP' | 'GQ' | 'GR' | 'GS' | 'GT' | 'GW' | 'GY' | 'HK' | 'HM' | 'HN' | 'HR' | 'HT' | 'HU' | 'ID' | 'IE' | 'IL' | 'IM' | 'IN' | 'IO' | 'IQ' | 'IR' | 'IS' | 'IT' | 'JE' | 'JM' | 'JO' | 'JP' | 'KE' | 'KG' | 'KH' | 'KI' | 'KM' | 'KN' | 'KP' | 'KR' | 'KW' | 'KY' | 'KZ' | 'LA' | 'LB' | 'LC' | 'LI' | 'LK' | 'LR' | 'LS' | 'LT' | 'LU' | 'LV' | 'LY' | 'MA' | 'MC' | 'MD' | 'ME' | 'MF' | 'MG' | 'MK' | 'ML' | 'MM' | 'MN' | 'MO' | 'MQ' | 'MR' | 'MS' | 'MT' | 'MU' | 'MV' | 'MW' | 'MX' | 'MY' | 'MZ' | 'NA' | 'NC' | 'NE' | 'NF' | 'NG' | 'NI' | 'NL' | 'NO' | 'NP' | 'NR' | 'NU' | 'NZ' | 'OM' | 'PA' | 'PE' | 'PF' | 'PG' | 'PH' | 'PK' | 'PL' | 'PM' | 'PN' | 'PS' | 'PT' | 'PY' | 'QA' | 'RE' | 'RO' | 'RS' | 'RU' | 'RW' | 'SA' | 'SB' | 'SC' | 'SD' | 'SE' | 'SG' | 'SH' | 'SI' | 'SJ' | 'SK' | 'SL' | 'SM' | 'SN' | 'SO' | 'SR' | 'SS' | 'ST' | 'SV' | 'SX' | 'SY' | 'SZ' | 'TA' | 'TC' | 'TD' | 'TF' | 'TG' | 'TH' | 'TJ' | 'TK' | 'TL' | 'TM' | 'TN' | 'TO' | 'TR' | 'TT' | 'TV' | 'TW' | 'TZ' | 'UA' | 'UG' | 'UM' | 'US' | 'UY' | 'UZ' | 'VA' | 'VC' | 'VE' | 'VG' | 'VN' | 'VU' | 'WF' | 'WS' | 'XK' | 'YE' | 'YT' | 'ZA' | 'ZM' | 'ZW' | 'ZZ' The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### provinceCode value: `string` The buyer's province code, such as state, province, prefecture, or region. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### phone value: `string` The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). ### PickupLocationOption ### type value: `"pickup"` The type of this delivery option. ### location value: `PickupLocation` - PickupLocation: interface PickupLocation { /** * The name of the pickup location. */ name?: string; /** * The address of the pickup location. */ address: MailingAddress; } The location details of the pickup location. ### handle value: `string` The unique identifier of the delivery option. ### title value: `string` The title of the delivery option. ### description value: `string` The description of the delivery option. ### code value: `string` The code of the delivery option. ### PickupLocation ### name value: `string` The name of the pickup location. ### address value: `MailingAddress` - MailingAddress: export interface MailingAddress { /** * The buyer's full name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John Doe' */ name?: string; /** * The buyer's first name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'John' */ firstName?: string; /** * The buyer's last name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Doe' */ lastName?: string; /** * The buyer's company name. * * {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Shopify' */ company?: string; /** * The first line of the buyer's address, including street name and number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '151 O'Connor Street' */ address1?: string; /** * The second line of the buyer's address, like apartment number, suite, etc. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ground floor' */ address2?: string; /** * The buyer's city. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'Ottawa' */ city?: string; /** * The buyer's postal or ZIP code. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'K2P 2L8' */ zip?: string; /** * The ISO 3166 Alpha-2 format for the buyer's country. Refer to https://www.iso.org/iso-3166-country-codes.html. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'CA' for Canada. */ countryCode?: CountryCode; /** * The buyer's province code, such as state, province, prefecture, or region. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example 'ON' for Ontario. */ provinceCode?: string; /** * The buyer's phone number. * * {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](https://shopify.dev/docs/apps/store/data-protection/protected-customer-data). * * @example '+1 613 111 2222'. */ phone?: string; } The address of the pickup location. ### DeliveryOptionReference Represents a reference to a delivery option. ### handle value: `string` The unique identifier of the referenced delivery option. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## PickupPointListApi This API object is provided to extensions registered for the `purchase.checkout.pickup-point-list.render-after` and `purchase.checkout.pickup-point-list.render-after` extension target. ### PickupPointListApi ### isLocationFormVisible value: `StatefulRemoteSubscribable` Whether the customer location input form is shown to the buyer. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## PickupLocationListApi This API object is provided to extensions registered for the `purchase.checkout.pickup-location-list.render-after` and `purchase.checkout.pickup-location-list.render-after` extension target. ### PickupLocationListApi ### isLocationFormVisible value: `StatefulRemoteSubscribable` Whether the customer location input form is shown to the buyer. ## Related - [Targets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) - [Components](https://shopify.dev/docs/api/checkout-ui-extensions/components) - [Configuration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) - [Tutorials](/apps/checkout) ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ``` ## Examples The APIs for interacting with delivery and shipping options. > > Tip: Not all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available. ```jsx import { reactExtension, Text, useSubscription, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => , ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. ); } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.shipping-option-item.render-after', (root, {target, isTargetSelected}) => { const titleText = root.createText( `Shipping method title: ${target.current.title}`, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( `Shipping method title: ${updatedTarget.title}`, ); }); const selectedText = root.createText( getSelectedText(isTargetSelected), ); root.appendChild(selectedText); isTargetSelected.subscribe( (updatedSelected) => { selectedText.updateText( getSelectedText(updatedSelected), ); }, ); function getSelectedText(selected) { return selected ? 'Selected' : 'Not selected'; } }, ); ``` ```jsx import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => , ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( The customer is being asked to provide their location. ); } else { return ( Pickup points are being shown. ); } } ``` ```js import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-point-list.render-before', (root, {isLocationFormVisible}) => { const content = root.createText( getTextContent( isLocationFormVisible.current, ), ); root.appendChild(content); isLocationFormVisible.subscribe( (updatedLocationFormVisible) => { content.updateText( getTextContent( updatedLocationFormVisible, ), ); }, ); function getTextContent( isLocationFormVisible, ) { if (isLocationFormVisible) { return 'The customer is being asked to provide their location.'; } else { return 'Pickup points are being shown.'; } } }, ); ``` ```jsx import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => , ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( First delivery option:{' '} {deliveryOptions[0].title} ); } ```