Abandoned checkout using graphQL

Hi,
I’m using the below query(screenshot) and getting the error: “Field ‘abandonedCheckoutsConnection’ doesn’t exist on type ‘QueryRoot’”.

I have tried multiple different queries but got the same response.
Please suggest the correct query to fetch all the abandoned checkout data using graphQL.
Below are the attachments of the query and response.

To fetch all the abandoned checkout data, you can use the abandonmentByAbandonedCheckoutId and abandonment queries from the Shopify GraphQL Admin API. Below are examples of how to use these queries:

query GetAbandonmentByCheckoutId {
  abandonmentByAbandonedCheckoutId(abandonedCheckoutId: "your_abandoned_checkout_id") {
    abandonedCheckoutPayload {
      abandonedCheckoutUrl
      id
      lineItems(first: 5) {
        edges {
          node {
            title
            quantity
            priceSet {
              shopMoney {
                amount
                currencyCode
              }
            }
          }
        }
      }
      lineItemsQuantity
      totalPriceSet {
        shopMoney {
          amount
          currencyCode
        }
      }
    }
    abandonmentType
    createdAt
    customer {
      email
      firstName
      lastName
    }
    emailSentAt
    emailState
  }
}
query GetAbandonmentById {
  abandonment(id: "your_abandonment_id") {
    abandonedCheckoutPayload {
      abandonedCheckoutUrl
      id
      lineItems(first: 5) {
        edges {
          node {
            title
            quantity
            priceSet {
              shopMoney {
                amount
                currencyCode
              }
            }
          }
        }
      }
      lineItemsQuantity
      totalPriceSet {
        shopMoney {
          amount
          currencyCode
        }
      }
    }
    abandonmentType
    createdAt
    customer {
      email
      firstName
      lastName
    }
    emailSentAt
    emailState
  }
}

Would these work for you?

1 Like

Hi @Liam ,
Thanks for the reply.
If I use abandonmentByAbandonedCheckoutId(abandonedCheckoutId: “your_abandoned_checkout_id”) then I have to pass the ID of the abandoned checkout and it will return data related to that abandoned_checkout.
But here I need to fetch all the abandoned checkout data between 2 updated_at dates without using a particular Id of abandoned checkout..
Please suggest.

2 Likes

Thanks @Liam . How do you get the list of “your_abandonment_id”? If you do not have that id, then these queries are of no use. What is the query to get the list of abandonment ids?

Thanks,

John

2 Likes