How can I query cart details by cart Id? why is it always returns null?

How can I query cart details by cart Id? why is it always returns null?

brodwen
Shopify Partner
2 0 0

I successfully created a cart per customer but somehow I can't seem to get the cart details using the cart query?
What am I missing? How to check the payment details of the cart?

 

Here's the query:

query {
  cart(
    id: "CART_ID_HERE"
  ) {
    id
    createdAt
    updatedAt
    lines(first: 10) {
      edges {
        node {
          id
          quantity
          merchandise {
            ... on ProductVariant {
              id
            }
          }
          attributes {
            key
            value
          }
        }
      }
    }
    attributes {
      key
      value
    }
    cost {
      totalAmount {
        amount
        currencyCode
      }
      subtotalAmount {
        amount
        currencyCode
      }
      totalTaxAmount {
        amount
        currencyCode
      }
      totalDutyAmount {
        amount
        currencyCode
      }
    }
    buyerIdentity {
      email
      phone
      customer {
        id
      }
      countryCode
      deliveryAddressPreferences {
        ... on MailingAddress {
          address1
          address2
          city
          provinceCode
          countryCodeV2
          zip
        }
      }
    }
  }
}

Result:

{
  "data": {
    "cart": null
  }
}

Also,

query checkoutURL {
  cart(id: "CART_ID_HERE") {
    checkoutUrl
  }
}

I can't seem to get the checkout url too.

{
  "data": {
    "cart": null
  }
}




Replies 0 (0)