Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Hey Community,
I am new to building shopify functions and have a usecase where we need to get the current delivery cost and update it based on some parameters.
I am following this tutorial and was trying to get estimatedCost in input but been running into error -
GraphQL Document Validation failed with 2 errors;
Error 0: Cannot query field "estimatedCost" on type "CartDeliveryOption".
at
query Input {
cart {
lines {
merchandise {
... on ProductVariant {
product {
id
}
}
}
}
deliveryGroups {
id
deliveryOptions {
handle
title
estimatedCost {
amount
}
}
selectedDeliveryOption{
code
deliveryMethodType
estimatedCost
}
}
}
}
Is there a way to get the cost associated with all delivery options?
Update :-
Seems like estimatedCost is deprecated, I was looking at old documentation ;(
Solved! Go to the solution
This is an accepted solution.
query Input {
cart {
lines {
merchandise {
... on ProductVariant {
product {
id
}
}
}
}
deliveryGroups {
id
deliveryOptions {
handle
title
estimatedCost {
amount
}
}
selectedDeliveryOption{
code
deliveryMethodType
cost
}
}
}
}
This is an accepted solution.
query Input {
cart {
lines {
merchandise {
... on ProductVariant {
product {
id
}
}
}
}
deliveryGroups {
id
deliveryOptions {
handle
title
estimatedCost {
amount
}
}
selectedDeliveryOption{
code
deliveryMethodType
cost
}
}
}
}