Discussing Shopify Functions development, deployment, and usage in Shopify apps.
Is there a way I can get a list of currently available shipping methods so I can display them to the customer inside a 3rd party app? Very similar to what checkout does.
I was only able to get a names and prices so far. I'm using
GET /admin/api/2022-04/shipping_zones.json
endpoint.
I'd love to know is there a way I can also get a shipping time information using Admin API? And what's the purpose of id property? Can I use it during Order creation (also using Admin API)?
Hi. How did it go? Could you find a way?
I'm facing same issue
QUERY;
Hi! A question. I'm trying to build a shipping discount app using Shopify functions and shipping discount API. When I query cart graphQL API for delivery methods, I get this response:
{ "id": "gid://shopify/CartDeliveryGroup/0", "deliveryOptions": [ { "handle": "16c3896838b1c095431f263d073856c9-73a2bf35e295daaa5f6254f4ae9788b8", "title": "Standard" }, { "handle": "16c3896838b1c095431f263d073856c9-aea3f94d72fdf702e20871d1b8918f56", "title": "Express" } ], "selectedDeliveryOption": { "handle": "16c3896838b1c095431f263d073856c9-73a2bf35e295daaa5f6254f4ae9788b8", "title": "Standard" } }
To apply the discount I use targets.deliveryOptions.handle . But how I can get this deliveryOption handle from the admin API( to surface the available options for user in the UI)?
When I'm executing your query I only get id and name, no handle.
You can show the names of your shipping methods by using the query above and then pass the names to the function and filter out the handles with the same name.
Like This code:
const selectedShippingOption =
input?.cart?.deliveryGroups[0]?.selectedDeliveryOption;
const getPayMethod = input?.paymentMethods.find((method) => method?.name.toLocaleLowerCase().includes("cash on delivery"));
if (selectedShippingOption?.title?.toLocaleLowerCase().includes("express")) {
return {
operations: [
{
hide: {
paymentMethodId: getPayMethod?.id || '',
}
}
]
}
}