Admin API - Querying orders with `firstVisit.referralCode`

klobo-pp
New Member
1 0 5

Reference doc - https://shopify.dev/api/admin/graphql/reference/common-objects/queryroot#orders-2021-07

Hi,

Is 'firstVisit.referralCode' and 'lastVisit.referralCode' on the 'Order' object query-able in any way?

We only want to fetch orders which have 'referralCode' set to specific value. Currently, fetching all the orders and then filtering through them takes a long time.

Is there way to fetch this data efficiently? I looked at the Webhook topic ("Orders/Create") as an alternative, but this would send a message for every order created too, not just the ones with 'referralCode = specificValue'.

orders(first: 100, query: "referralCode:'value'") {
      edges {
        cursor
        node {
          id
        }
      }
    }

Thanks!

Replies 0 (0)