get shippingRate handle via rest api

Solved

get shippingRate handle via rest api

shoshana
Shopify Partner
4 0 2

Hi everyone
Is there a way to get the shippingRate handle through the rest API?
I call https://shopify.dev/docs/api/admin-rest/2024-01/resources/shippingzone

and get all shippingRates with ids
But in the shipping-discount function I need to send deliveryOption.handle
https://shopify.dev/docs/api/functions/reference/shipping-discounts/graphql#functionrunresult

can I convert from shippingRate.id to deliveryOption.handle?

Accepted Solutions (2)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi Shoshana,

 

I think I see the issue you're experiencing - in GraphQL the ShippingRate object has a handle field, but this is not accessible in REST - is this the issue that's blocking you from completing this tutorial?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

VladSofronov
Shopify Partner
6 1 3

This is an accepted solution.

Can you elaborate? I'm also trying to access deliveryOptions.handle via graphql admin and don't understand how to do it.

 

I'm trying to build shipping discount app using shopify functions and I'm trying to figure out how to make deliveryOption to discount user controllable, and in order to do it I need to get it handle from my app(not from function) to pass it to app via metafields I guess

View solution in original post

Replies 2 (2)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi Shoshana,

 

I think I see the issue you're experiencing - in GraphQL the ShippingRate object has a handle field, but this is not accessible in REST - is this the issue that's blocking you from completing this tutorial?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

VladSofronov
Shopify Partner
6 1 3

This is an accepted solution.

Can you elaborate? I'm also trying to access deliveryOptions.handle via graphql admin and don't understand how to do it.

 

I'm trying to build shipping discount app using shopify functions and I'm trying to figure out how to make deliveryOption to discount user controllable, and in order to do it I need to get it handle from my app(not from function) to pass it to app via metafields I guess