DeliveryAPI
The APIs for interacting with delivery and shipping options.
TipNot all extension targets implement all APIs. Check the documentation for the extension target you are using to see which APIs are available.
Anchor to standardapiStandardApi
The base API object provided to purchase
extension targets.
- Anchor to deliveryGroupsdeliveryGroupsStatefulRemoteSubscribable<[]>required
A list of delivery groups containing information about the delivery of the items the customer intends to purchase.
Docs_Standard_DeliveryApi
- deliveryGroups
A list of delivery groups containing information about the delivery of the items the customer intends to purchase.
StatefulRemoteSubscribable<DeliveryGroup[]>
export interface Docs_Standard_DeliveryApi
extends Pick<StandardApi, 'deliveryGroups'> {}
DeliveryGroup
Represents the delivery information and options available for one or more cart lines.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
Returns the full expanded details of a delivery group and automatically re-renders your component when that delivery group changes.
Anchor to useDeliveryGroup-parametersParameters
- Anchor to deliveryGroupdeliveryGrouprequired
UseDeliveryGroupGeneratedType
Returns the full expanded details of a delivery group and automatically re-renders your component when that delivery group changes.
- deliveryGroup
DeliveryGroup
DeliveryGroupDetails | undefined
export function useDeliveryGroup<
ID extends RenderExtensionTarget = RenderExtensionTarget,
>(deliveryGroup: DeliveryGroup | undefined): DeliveryGroupDetails | undefined {
const {lines} = useApi<ID>();
const cartLines = useSubscription(lines);
return useMemo(() => {
if (!deliveryGroup) {
return undefined;
}
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.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
DeliveryGroupDetails
Represents a DeliveryGroup with expanded reference fields and full details.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOption
- targetedCartLines
The cart lines associated to the delivery group.
CartLine[]
export interface DeliveryGroupDetails extends DeliveryGroup {
/**
* The selected delivery option for the delivery group.
*/
selectedDeliveryOption?: DeliveryOption;
/**
* The cart lines associated to the delivery group.
*/
targetedCartLines: CartLine[];
}
CartLine
- attributes
The line item additional custom attributes.
Attribute[]
- cost
The details about the cost components attributed to the cart line.
CartLineCost
- discountAllocations
Discounts applied to the cart line.
CartDiscountAllocation[]
- id
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.
string
- lineComponents
Sub lines of the merchandise line. If no sub lines are present, this will be an empty array.
CartBundleLineComponent[]
- merchandise
The merchandise being purchased.
Merchandise
- quantity
The quantity of the merchandise being purchased.
number
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[];
}
Attribute
- key
The key for the attribute.
string
- value
The value for the attribute.
string
export interface Attribute {
/**
* The key for the attribute.
*/
key: string;
/**
* The value for the attribute.
*/
value: string;
}
CartLineCost
- totalAmount
The total amount after reductions the buyer can expect to pay that is directly attributable to a single cart line.
Money
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;
}
CartDiscountAllocation
CartCodeDiscountAllocation | CartAutomaticDiscountAllocation | CartCustomDiscountAllocation
CartCodeDiscountAllocation
- code
The code for the discount
string
- discountedAmount
The money amount that has been discounted from the order
Money
- type
The type of the code discount
"code"
export interface CartCodeDiscountAllocation extends CartDiscountAllocationBase {
/**
* The code for the discount
*/
code: string;
/**
* The type of the code discount
*/
type: 'code';
}
CartAutomaticDiscountAllocation
- discountedAmount
The money amount that has been discounted from the order
Money
- title
The title of the automatic discount
string
- type
The type of the automatic discount
"automatic"
export interface CartAutomaticDiscountAllocation
extends CartDiscountAllocationBase {
/**
* The title of the automatic discount
*/
title: string;
/**
* The type of the automatic discount
*/
type: 'automatic';
}
CartCustomDiscountAllocation
- discountedAmount
The money amount that has been discounted from the order
Money
- title
The title of the custom discount
string
- type
The type of the custom discount
"custom"
export interface CartCustomDiscountAllocation
extends CartDiscountAllocationBase {
/**
* The title of the custom discount
*/
title: string;
/**
* The type of the custom discount
*/
type: 'custom';
}
CartBundleLineComponent
- attributes
Additional custom attributes for the bundle line component.
Attribute[]
- cost
The cost attributed to this bundle line component.
CartLineCost
- id
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.
string
- merchandise
The merchandise of this bundle line component.
Merchandise
- quantity
The quantity of merchandise being purchased.
number
- type
"bundle"
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[];
}
Merchandise
- id
A globally-unique identifier.
string
- image
Image associated with the product variant. This field falls back to the product image if no image is available.
ImageDetails
- product
The product object that the product variant belongs to.
Product
- requiresShipping
Whether or not the product requires shipping.
boolean
- selectedOptions
List of product options applied to the variant.
SelectedOption[]
- sellingPlan
The selling plan associated with the merchandise.
SellingPlan
- sku
The product variant's sku.
string
- subtitle
The product variant's subtitle.
string
- title
The product variant’s title.
string
- type
"variant"
ProductVariant
ImageDetails
- altText
The alternative text for the image.
string
- url
The image URL.
string
export interface ImageDetails {
/**
* The image URL.
*/
url: string;
/**
* The alternative text for the image.
*/
altText?: string;
}
Product
- id
A globally-unique identifier.
string
- productType
A categorization that a product can be tagged with, commonly used for filtering and searching.
string
- vendor
The product’s vendor name.
string
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;
}
SelectedOption
- name
The name of the merchandise option.
string
- value
The value of the merchandise option.
string
export interface SelectedOption {
/**
* The name of the merchandise option.
*/
name: string;
/**
* The value of the merchandise option.
*/
value: string;
}
SellingPlan
- id
A globally-unique identifier.
string
- recurringDeliveries
Whether purchasing the selling plan will result in multiple deliveries.
boolean
export interface SellingPlan {
/**
* A globally-unique identifier.
* @example 'gid://shopify/SellingPlan/1'
*/
id: string;
/**
* Whether purchasing the selling plan will result in multiple deliveries.
*/
recurringDeliveries: boolean;
}
Anchor to useDeliveryGroupsuse Delivery Groups()
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.
DeliveryGroup[]
export function useDeliveryGroups<
Target extends RenderExtensionTarget = RenderExtensionTarget,
>(): DeliveryGroup[] {
const api = useApi<Target>();
return useSubscription(api.deliveryGroups);
}
DeliveryGroup
Represents the delivery information and options available for one or more cart lines.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
Anchor to shipping optionShipping 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.
- Anchor to isTargetSelectedisTargetSelectedStatefulRemoteSubscribable<boolean>required
Whether the shipping option the extension is attached to is currently selected in the UI.
- Anchor to renderModerenderModerequired
The render mode of the shipping option.
- Anchor to targettargetStatefulRemoteSubscribable<>required
The shipping option the extension is attached to.
ShippingOptionItemApi
- isTargetSelected
Whether the shipping option the extension is attached to is currently selected in the UI.
StatefulRemoteSubscribable<boolean>
- renderMode
The render mode of the shipping option.
ShippingOptionItemRenderMode
- target
The shipping option the extension is attached to.
StatefulRemoteSubscribable<ShippingOption>
export interface ShippingOptionItemApi {
/**
* The shipping option the extension is attached to.
*/
target: StatefulRemoteSubscribable<ShippingOption>;
/**
* Whether the shipping option the extension is attached to is currently selected in the UI.
*/
isTargetSelected: StatefulRemoteSubscribable<boolean>;
/**
* The render mode of the shipping option.
*/
renderMode: ShippingOptionItemRenderMode;
}
ShippingOptionItemRenderMode
The render mode of a shipping option.
- overlay
Whether the shipping option is rendered in an overlay.
boolean
export interface ShippingOptionItemRenderMode {
/**
* Whether the shipping option is rendered in an overlay.
*/
overlay: boolean;
}
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
Anchor to useShippingOptionTargetuse Shipping Option Target()
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`
{
shippingOptionTarget: ShippingOption;
isTargetSelected: boolean;
renderMode: ShippingOptionItemRenderMode;
}
export function useShippingOptionTarget(): {
shippingOptionTarget: ShippingOption;
isTargetSelected: boolean;
renderMode: ShippingOptionItemRenderMode;
} {
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 renderMode = api.renderMode;
const shippingOption = useMemo(() => {
return {
shippingOptionTarget,
isTargetSelected,
renderMode,
};
}, [shippingOptionTarget, isTargetSelected, renderMode]);
return shippingOption;
}
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
ShippingOptionItemRenderMode
The render mode of a shipping option.
- overlay
Whether the shipping option is rendered in an overlay.
boolean
export interface ShippingOptionItemRenderMode {
/**
* Whether the shipping option is rendered in an overlay.
*/
overlay: boolean;
}
Anchor to shippingoptionlistapiShippingOptionListApi
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.
- Anchor to deliverySelectionGroupsdeliverySelectionGroupsStatefulRemoteSubscribable< [] | undefined >required
The list of selection groups available to the buyers. The property will be undefined when no such groups are available.
- Anchor to targettargetStatefulRemoteSubscribable< | undefined>required
The delivery group list the extension is attached to. The target will be undefined when there are no groups for a given type.
ShippingOptionListApi
- deliverySelectionGroups
The list of selection groups available to the buyers. The property will be undefined when no such groups are available.
StatefulRemoteSubscribable< DeliverySelectionGroup[] | undefined >
- target
The delivery group list the extension is attached to. The target will be undefined when there are no groups for a given type.
StatefulRemoteSubscribable<DeliveryGroupList | undefined>
export interface ShippingOptionListApi {
/**
* The delivery group list the extension is attached to. The target will be undefined when there are no groups for a given type.
*/
target: StatefulRemoteSubscribable<DeliveryGroupList | undefined>;
/**
* The list of selection groups available to the buyers. The property will be undefined when no such groups are available.
*/
deliverySelectionGroups: StatefulRemoteSubscribable<
DeliverySelectionGroup[] | undefined
>;
}
DeliverySelectionGroup
A selection group for delivery options.
- associatedDeliveryOptions
The associated delivery option handles with the selection group. The handles will match the delivery group's delivery option handles.
DeliveryOptionReference[]
- cost
The sum of each delivery option's cost.
Money
- costAfterDiscounts
The sum of each delivery option's cost after discounts.
Money
- handle
The handle of the selection group.
string
- selected
If the selection group is selected.
boolean
- title
The localized title of the selection group.
string
export interface DeliverySelectionGroup {
/**
* The handle of the selection group.
*/
handle: string;
/**
* If the selection group is selected.
*/
selected: boolean;
/**
* The localized title of the selection group.
*/
title: string;
/**
* The associated delivery option handles with the selection group. The handles will match the delivery group's delivery option handles.
*/
associatedDeliveryOptions: DeliveryOptionReference[];
/**
* The sum of each delivery option's cost.
*/
cost: Money;
/**
* The sum of each delivery option's cost after discounts.
*/
costAfterDiscounts: Money;
}
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryGroupList
The delivery group list the extension is associated to.
- deliveryGroups
The delivery groups that compose this list.
DeliveryGroup[]
- groupType
The group type of the delivery group list.
DeliveryGroupType
export interface DeliveryGroupList {
/**
* The group type of the delivery group list.
*/
groupType: DeliveryGroupType;
/**
* The delivery groups that compose this list.
*/
deliveryGroups: DeliveryGroup[];
}
DeliveryGroup
Represents the delivery information and options available for one or more cart lines.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
Anchor to useDeliveryGroupTargetuse Delivery Group Target()
Returns the delivery group for the purchase.checkout.shipping-option-list.render-before
and purchase.checkout.shipping-option-list.render-after
attached extensions. This is deprecated, use instead.
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 > Caution: Deprecated as of version `2024-07`, use `useDeliveryGroupListTarget()` instead.
DeliveryGroup | undefined
export function useDeliveryGroupTarget(): DeliveryGroup | undefined {
const api = useApi<
| 'purchase.checkout.shipping-option-list.render-before'
| 'purchase.checkout.shipping-option-list.render-after'
>();
const target = useSubscription(api.target);
return target?.deliveryGroups[0];
}
DeliveryGroup
Represents the delivery information and options available for one or more cart lines.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
Anchor to useDeliveryGroupListTargetuse Delivery Group List Target()
Returns the delivery group list for the purchase.checkout.shipping-option-list.render-before
and purchase.checkout.shipping-option-list.render-after
attached extensions.
UseDeliveryGroupListTargetGeneratedType
Returns the delivery group list 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
DeliveryGroupList | undefined
export function useDeliveryGroupListTarget(): DeliveryGroupList | undefined {
const api = useApi<
| 'purchase.checkout.shipping-option-list.render-before'
| 'purchase.checkout.shipping-option-list.render-after'
>();
return useSubscription(api.target);
}
DeliveryGroupList
The delivery group list the extension is associated to.
- deliveryGroups
The delivery groups that compose this list.
DeliveryGroup[]
- groupType
The group type of the delivery group list.
DeliveryGroupType
export interface DeliveryGroupList {
/**
* The group type of the delivery group list.
*/
groupType: DeliveryGroupType;
/**
* The delivery groups that compose this list.
*/
deliveryGroups: DeliveryGroup[];
}
DeliveryGroup
Represents the delivery information and options available for one or more cart lines.
- deliveryOptions
The delivery options available for the delivery group.
DeliveryOption[]
- groupType
The type of the delivery group.
DeliveryGroupType
- id
The unique identifier of the delivery group. On the Thank You page this value is undefined.
string
- isDeliveryRequired
Whether delivery is required for the delivery group.
boolean
- selectedDeliveryOption
The selected delivery option for the delivery group.
DeliveryOptionReference
- targetedCartLines
The cart line references associated to the delivery group.
CartLineReference[]
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;
}
DeliveryOption
ShippingOption | PickupPointOption | PickupLocationOption
ShippingOption
Represents a delivery option that is a shipping option.
- carrier
Information about the carrier.
ShippingOptionCarrier
- code
The code of the delivery option.
string
- cost
The cost of the delivery.
Money
- costAfterDiscounts
The cost of the delivery including discounts.
Money
- deliveryEstimate
Information about the estimated delivery time.
DeliveryEstimate
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
'shipping' | 'local'
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
- name
The name of the carrier.
string
export interface ShippingOptionCarrier {
/**
* The name of the carrier.
*/
name?: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
DeliveryEstimate
- timeInTransit
The estimated time in transit for the delivery in seconds.
NumberRange
export interface DeliveryEstimate {
/**
* The estimated time in transit for the delivery in seconds.
*/
timeInTransit?: NumberRange;
}
NumberRange
- lower
The lower bound of the number range.
number
- upper
The upper bound of the number range.
number
export interface NumberRange {
/**
* The lower bound of the number range.
*/
lower?: number;
/**
* The upper bound of the number range.
*/
upper?: number;
}
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
PickupPointOption
- carrier
Information about the carrier that ships to the pickup point.
PickupPointCarrier
- code
The code of the delivery option.
string
- cost
The cost to ship to this pickup point.
Money
- costAfterDiscounts
The cost to ship to this pickup point including discounts.
Money
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup point.
PickupPointLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickupPoint"
export interface PickupPointOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickupPoint';
/**
* Information about the carrier that ships to the pickup point.
*/
carrier: PickupPointCarrier;
/**
* The cost to ship to this pickup point.
*/
cost: Money;
/**
* The cost to ship to this pickup point including discounts.
*/
costAfterDiscounts: Money;
/**
* The location details of the pickup point.
*/
location: PickupPointLocation;
}
PickupPointCarrier
- code
The code identifying the carrier.
string
- name
The name of the carrier.
string
interface PickupPointCarrier {
/**
* The code identifying the carrier.
*/
code?: string;
/**
* The name of the carrier.
*/
name?: string;
}
PickupPointLocation
- address
The address of the pickup point.
MailingAddress
- handle
The unique identifier of the pickup point.
string
- name
The name of the pickup point.
string
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;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
DeliveryGroupType
The possible types of a delivery group.
'oneTimePurchase' | 'subscription'
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
CartLineReference
Represents a reference to a cart line.
- id
The unique identifier of the referenced cart line.
string
export interface CartLineReference {
/**
* The unique identifier of the referenced cart line.
*/
id: string;
}
Anchor to useDeliverySelectionGroupsuse Delivery Selection Groups()
Returns the delivery selection groups for the purchase.checkout.shipping-option-list.render-before
and purchase.checkout.shipping-option-list.render-after
attached extensions.
UseDeliverySelectionGroupsGeneratedType
Returns the list of delivery selection groups available to the buyers. 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
| DeliverySelectionGroup[]
| undefined
export function useDeliverySelectionGroups():
| DeliverySelectionGroup[]
| undefined {
const api = useApi<
| 'purchase.checkout.shipping-option-list.render-before'
| 'purchase.checkout.shipping-option-list.render-after'
>();
return useSubscription(api.deliverySelectionGroups);
}
DeliverySelectionGroup
A selection group for delivery options.
- associatedDeliveryOptions
The associated delivery option handles with the selection group. The handles will match the delivery group's delivery option handles.
DeliveryOptionReference[]
- cost
The sum of each delivery option's cost.
Money
- costAfterDiscounts
The sum of each delivery option's cost after discounts.
Money
- handle
The handle of the selection group.
string
- selected
If the selection group is selected.
boolean
- title
The localized title of the selection group.
string
export interface DeliverySelectionGroup {
/**
* The handle of the selection group.
*/
handle: string;
/**
* If the selection group is selected.
*/
selected: boolean;
/**
* The localized title of the selection group.
*/
title: string;
/**
* The associated delivery option handles with the selection group. The handles will match the delivery group's delivery option handles.
*/
associatedDeliveryOptions: DeliveryOptionReference[];
/**
* The sum of each delivery option's cost.
*/
cost: Money;
/**
* The sum of each delivery option's cost after discounts.
*/
costAfterDiscounts: Money;
}
DeliveryOptionReference
Represents a reference to a delivery option.
- handle
The unique identifier of the referenced delivery option.
string
export interface DeliveryOptionReference {
/**
* The unique identifier of the referenced delivery option.
*/
handle: string;
}
Money
- amount
The price amount.
number
- currencyCode
The ISO 4217 format for the currency.
CurrencyCode
export interface Money {
/**
* The price amount.
*/
amount: number;
/**
* The ISO 4217 format for the currency.
* @example 'CAD' for Canadian dollar
*/
currencyCode: 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'
Anchor to pickuppointlistapiPickupPointListApi
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.
- Anchor to isLocationFormVisibleisLocationFormVisibleStatefulRemoteSubscribable<boolean>required
Whether the customer location input form is shown to the buyer.
PickupPointListApi
- isLocationFormVisible
Whether the customer location input form is shown to the buyer.
StatefulRemoteSubscribable<boolean>
export interface PickupPointListApi {
/**
* Whether the customer location input form is shown to the buyer.
*/
isLocationFormVisible: StatefulRemoteSubscribable<boolean>;
}
Anchor to pickuplocationlistapiPickupLocationListApi
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.
- Anchor to isLocationFormVisibleisLocationFormVisibleStatefulRemoteSubscribable<boolean>required
Whether the customer location input form is shown to the buyer.
PickupLocationListApi
- isLocationFormVisible
Whether the customer location input form is shown to the buyer.
StatefulRemoteSubscribable<boolean>
export interface PickupLocationListApi {
/**
* Whether the customer location input form is shown to the buyer.
*/
isLocationFormVisible: StatefulRemoteSubscribable<boolean>;
}
Anchor to pickuplocationitemapiPickupLocationItemApi
The API object provided to the purchase.checkout.pickup-location-option-item.render-after
extension target.
- Anchor to isTargetSelectedisTargetSelectedStatefulRemoteSubscribable<boolean>required
Whether the pickup location is currently selected.
- Anchor to targettargetStatefulRemoteSubscribable<>required
The pickup location the extension is attached to.
PickupLocationItemApi
- isTargetSelected
Whether the pickup location is currently selected.
StatefulRemoteSubscribable<boolean>
- target
The pickup location the extension is attached to.
StatefulRemoteSubscribable<PickupLocationOption>
export interface PickupLocationItemApi {
/**
* The pickup location the extension is attached to.
*/
target: StatefulRemoteSubscribable<PickupLocationOption>;
/**
* Whether the pickup location is currently selected.
*/
isTargetSelected: StatefulRemoteSubscribable<boolean>;
}
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
Anchor to usePickupLocationOptionTargetuse Pickup Location Option Target()
Returns the pickup location option for purchase.checkout.pickup-location-option-item.render-after
attached extensions.
UsePickupLocationOptionTargetGeneratedType
Returns the pickup location option the extension is attached to. This hook can only be used by extensions in the following extension target: - `purchase.checkout.pickup-location-option-item.render-after`
{
pickupLocationOptionTarget: PickupLocationOption;
isTargetSelected: boolean;
}
export function usePickupLocationOptionTarget(): {
pickupLocationOptionTarget: PickupLocationOption;
isTargetSelected: boolean;
} {
const api =
useApi<'purchase.checkout.pickup-location-option-item.render-after'>();
if (!api.target || api.isTargetSelected === undefined) {
throw new ExtensionHasNoTargetError(
'usePickupLocationOptionTarget',
api.extension.target,
);
}
const pickupLocationOptionTarget = useSubscription(api.target);
const isTargetSelected = useSubscription(api.isTargetSelected);
const pickupLocationOption = useMemo(() => {
return {
pickupLocationOptionTarget,
isTargetSelected,
};
}, [pickupLocationOptionTarget, isTargetSelected]);
return pickupLocationOption;
}
PickupLocationOption
- code
The code of the delivery option.
string
- description
The description of the delivery option.
string
- handle
The unique identifier of the delivery option.
string
- location
The location details of the pickup location.
PickupLocation
- metafields
The metafields associated with this delivery option.
Metafield[]
- title
The title of the delivery option.
string
- type
The type of this delivery option.
"pickup"
export interface PickupLocationOption extends DeliveryOptionBase {
/**
* The type of this delivery option.
*/
type: 'pickup';
/**
* The location details of the pickup location.
*/
location: PickupLocation;
}
PickupLocation
- address
The address of the pickup location.
MailingAddress
- name
The name of the pickup location.
string
interface PickupLocation {
/**
* The name of the pickup location.
*/
name?: string;
/**
* The address of the pickup location.
*/
address: MailingAddress;
}
MailingAddress
- address1
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](/docs/apps/store/data-protection/protected-customer-data).
string
- address2
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](/docs/apps/store/data-protection/protected-customer-data).
string
- city
The buyer's city. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- company
The buyer's company name. {% include /apps/checkout/privacy-icon.md %} Requires level 1 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- countryCode
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](/docs/apps/store/data-protection/protected-customer-data).
CountryCode
- firstName
The buyer's first name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- lastName
The buyer's last name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- name
The buyer's full name. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- phone
The buyer's phone number. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
- provinceCode
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](/docs/apps/store/data-protection/protected-customer-data).
string
- zip
The buyer's postal or ZIP code. {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/docs/apps/store/data-protection/protected-customer-data).
string
export interface MailingAddress {
/**
* The buyer's full name.
*
* {% include /apps/checkout/privacy-icon.md %} Requires level 2 access to [protected customer data](/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](/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](/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](/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](/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](/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](/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](/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](/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](/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](/docs/apps/store/data-protection/protected-customer-data).
*
* @example '+1 613 111 2222'.
*/
phone?: string;
}
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'
Metafield
Metadata associated with the checkout.
- key
The name of the metafield. It must be between 3 and 30 characters in length (inclusive).
string
- namespace
A container for a set of metafields. You need to define a custom namespace for your metafields to distinguish them from the metafields used by other apps. This must be between 2 and 20 characters in length (inclusive).
string
- value
The information to be stored as metadata.
string | number
- valueType
The metafield’s information type.
'integer' | 'string' | 'json_string'
export interface Metafield {
/**
* The name of the metafield. It must be between 3 and 30 characters in
* length (inclusive).
*/
key: string;
/**
* A container for a set of metafields. You need to define a custom
* namespace for your metafields to distinguish them from the metafields
* used by other apps. This must be between 2 and 20 characters in length (inclusive).
*/
namespace: string;
/**
* The information to be stored as metadata.
*/
value: string | number;
/** The metafield’s information type. */
valueType: 'integer' | 'string' | 'json_string';
}
Delivery group
React
examples
Delivery group
React
import { reactExtension, Banner, useDeliveryGroups, useDeliveryGroup, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => <Extension />, ); function Extension() { const deliveryGroups = useDeliveryGroups(); const firstDeliveryGroup = useDeliveryGroup( deliveryGroups[0], ); if (!firstDeliveryGroup) { return null; } const selectedDeliveryOption = firstDeliveryGroup?.selectedDeliveryOption; return ( <Banner> Selected delivery option:{' '} {selectedDeliveryOption?.title} </Banner> ); }
Anchor to examplesExamples
Learn how to use the API with JavaScript (JS) and React. See React Hooks for all available hooks.
Anchor to example-reading-the-selected-shipping-optionReading the selected shipping option
Anchor to example-reading-the-selected-pickup-location-optionReading the selected pickup location option
Anchor to example-determine-if-the-location-input-form-is-shownDetermine if the location input form is shown
Anchor to example-delivery-groupsDelivery groups
Reading the selected shipping option
examples
Reading the selected shipping option
React
import { reactExtension, Text, useShippingOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.shipping-option-item.render-after', () => <Extension />, ); function Extension() { const {shippingOptionTarget, isTargetSelected} = useShippingOptionTarget(); const title = shippingOptionTarget.title; return ( <Text> Shipping method: {title} is{' '} {isTargetSelected ? '' : 'not'} selected. </Text> ); }
JavaScript
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'; } }, );
Reading the selected pickup location option
React
import { reactExtension, Text, usePickupLocationOptionTarget, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-location-option-item.render-after', () => <Extension />, ); function Extension() { const { isTargetSelected, pickupLocationOptionTarget, } = usePickupLocationOptionTarget(); const title = pickupLocationOptionTarget?.title; if (isTargetSelected) { return <Text>{title}</Text>; } return null; }
JavaScript
import {extension} from '@shopify/ui-extensions/checkout'; export default extension( 'purchase.checkout.pickup-location-option-item.render-after', (root, {isTargetSelected, target}) => { const titleText = root.createText( target.current.title, ); root.appendChild(titleText); target.subscribe((updatedTarget) => { titleText.updateText( 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'; } }, );
Determine if the location input form is shown
React
import { reactExtension, useApi, useSubscription, Text, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.pickup-point-list.render-before', () => <Extension />, ); function Extension() { const {isLocationFormVisible} = useApi<'purchase.checkout.pickup-point-list.render-before'>(); const locationFormShown = useSubscription( isLocationFormVisible, ); if (locationFormShown) { return ( <Text> The customer is being asked to provide their location. </Text> ); } else { return ( <Text>Pickup points are being shown.</Text> ); } }
JavaScript
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.'; } } }, );
Delivery groups
React
import { reactExtension, Banner, useDeliveryGroups, } from '@shopify/ui-extensions-react/checkout'; export default reactExtension( 'purchase.checkout.block.render', () => <Extension />, ); function Extension() { const deliveryGroups = useDeliveryGroups(); const deliveryOptions = deliveryGroups[0].deliveryOptions; return ( <Banner> First delivery option:{' '} {deliveryOptions[0].title} </Banner> ); }