Hi there!
I’m working on an app to customize delivery options where I pull the existing options from GraphQL’s DeliveryMethodDefinition
to determine customization of shipping options on checkout.
Where I’ve run into trouble is pairing the Delivery Customization API Function Input CartDeliveryOption
to the GraphQL equivalent DeliveryMethodDefinition
.
For some reason the CartDeliveryOption
doesn’t reference the DeliveryMethodDefinition
ID, and only has properties like title
or cost
in common (which are not unique).
I do see a handle
on the Function Input which seems unique but it’s not available in GraphQL.
Anyone run into this before? Any thoughts?
References:
GraphQL DeliveryMethodDefinition
Function Input CartDeliveryOption
Bumping this as I’ve had a few merchant complains related to it.
As a workaround I’ve resorted to using the title
field as a ‘unique’ identifier which has come with some consequences. Any response from Shopify devs around when we could expect we could close the loop on this customization?
Seems crazy to give us a Delivery Customization API yet not directly show a link to the underlying Delivery Methods which merchants setup.
Hi Majd,
I’ve connected with the relevant team on this and will update here with their recommendation. In the meantime, would the code
field on the CartDeliveryOption object match up with anything you could use?
Hi Liam, thanks for checking with the team. I’ve looked into the code
field however I don’t see where this is generated and how it’s linked? It seems like an arbitrary ID that’s not referenced in the DeliveryMethod
Hi again Majd,
So it looks like the current state is actually intentional, our product team have said that Delivery Customization is a buyer facing checkout UI customisation – it’s for tweaking presentation rather than really changing business logic.
Delivery Method Defitions are the business logic, but there’s isn’t a one-to-one mapping into options because methods are filtered and consolidated into options before they are presented to user.
If you could describe your usecase a bit more and what you’re trying to achieve that will give us a better sense on the best approach here.
Hi Liam basically this issue boils down to the fact that the DeliveryCustomization API provides a way to customize shipping options via a handle that we cannot possibly know before hand.
A perfect way to see this is the actual Delivery Customization API examples provided in the Shopify documentation here
Specifically navigate to the example for hiding items based on a customer tag.
The example shows a function which stores a configuration metafield with a field named hiddenDeliveryOptions
. It’s a list of tags, under each tag is an array of handles.
The flaw here is, how can a developer ever BUILD this metafield configuration, if we can’t query the handles in the Admin API?
Logically, we’d expect the DeliveryMethodDefinition in the Admin API (which is the closest related object we have access to) to reference it, but it doesn’t.
That makes the example provided impossible to implement currently because of this limitation. Am I missing something?