How to get selected delivery options in Shopify app using function extension?

Topic summary

Main issue: In Shopify Function Extensions, querying input.cart.deliveryGroups to read the selected delivery option at checkout returns an empty array.

Key observations:

  • Multiple developers report deliveryGroups is empty in Order Discount functions, even when cartBuyerIdentityUpdate succeeds and in Shopify GraphiQL.
  • Shipping Discount functions do return deliveryGroups correctly, indicating a difference between function types despite identical input.cart types in docs.

Latest clarification:

  • This behavior is a documented limitation of the Order Discount Function API (see “About the Order Discount Function API” → “Limitations and considerations”). The GraphQL reference lists deliveryGroups, but it will not populate in Order Discount functions.

Implications:

  • Use cases that rely on applying order discounts based on selected delivery method (e.g., local delivery/pickup) are not supported directly.
  • Some teams updated project scope and implemented less-ideal workarounds.

Status:

  • No platform fix or official workaround announced. The discussion points to consulting the limitations documentation and exploring alternative approaches outside Order Discount functions.
Summarized with AI on December 16. AI used: gpt-5.

In a Shopify app with a function extension I am trying to get in the input.graphql the delivery options selected at checkout. In the docs i didn’t find anything.

I came up with the following. Everything works but deliveryGroups returns always a empty array. Did someone is facing the same?

Thanks in advance.

F.

query Input {
	cart {
		lines {
			quantity
			merchandise {
				__typename
				... on ProductVariant {
					id
					sku
				}
			}
		}
		deliveryGroups {
			selectedDeliveryOption {
				deliveryMethodType
			}
		}
	}
	discountNode {
		metafield(namespace: "function-discounts", key: "function-config") {
			value
		}
	}
}
3 Likes

I’m facing the same issue. It takes time to investigate if I’m doing wrong, but finally I realized that it’s the issue of platform.

1 Like

We are facing the same thing but only for Order Discounts functions, while for Shipping Discount functions we get the deliveryGroups fine. Seems to be an issue with the Order Discount API, although the input.cart type is identical between the 2 https://shopify.dev/docs/api/functions/reference/order-discounts/graphql/common-objects/cart

I’m having the same issue with cart query. I can confirm that I’m mutating “cartBuyerIdentityUpdate” successfully but deliveryGroup is always empty no matter what I try. My store only have local Delivery and pickup options and I’m coding a Hydrogen store.

What’s the catch with this deliveryGroup? Is it available only under some conditions or what should we check further?
Ps. I’m having the same issue with shopify-graphiql-app

Hey !
I know it’s been a while, but I’m facing the exact same issue and I haven’t been able to find a solution yet.
Did you work it out ?

Thanks !

No solutions yet, probably a platform issue.

Yep, no solutions unfortunately. Had to update scope of the specs with the client and tried to solve the main problem in another way

For those experiencing getting an empty deliveryGroups array in the Order Discount Function, this is a documented limitation of the function. Unfortunately, the field is listed as an available property of the input query and there is no mention that it always returns an empty array in the function GraphQL API reference docs. If relying on the function GraphQL API reference to determine compatibility, you will be led astray as I was. The limitation is listed in the ‘About the Order Discount Function API’ page under ‘Limitations and considerations’. Link to doc here: https://shopify.dev/docs/api/functions/reference/order-discounts

It would be great if Shopify gave us this information with the Order Discount function or at the very least update the docs, so it’s more clear. Our use case is that we want to provide an order discount based on certain delivery methods selected. We had to find a workaround that is not as ideal.

1 Like