Solved

Get deliveryOptions estimatedCost Input Error

kunkelmiss
Shopify Partner
3 0 2

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 ;(

 

Accepted Solution (1)

Kyle_liu
Shopify Partner
11 2 4

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
      }
    }
  }
}

 

Kyle_liu_0-1683614739787.png

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on (liushuaicc@shinetechsoftware.com)

View solution in original post

Reply 1 (1)

Kyle_liu
Shopify Partner
11 2 4

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
      }
    }
  }
}

 

Kyle_liu_0-1683614739787.png

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on (liushuaicc@shinetechsoftware.com)