Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Admin API - Querying orders with `firstVisit.referralCode`

Admin API - Querying orders with `firstVisit.referralCode`

klobo-pp
Visitor
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)