Test Order Count

rosestore
New Member
3 0 0

Hello,

We are in the process of creating our app. One of our processes is to create an event when a customer order count = 1.  If order count > 1 then don't do anything

We're testing create orders but each time webhook shows process count = 0.  Even if we use API, count is 0.   How do we test order count without having to process (charge) an order?

Thanks

0 Likes
syf_
Shopify Staff
Shopify Staff
81 18 14

Hi @rosestore,

I've looked into this issue for you, and I can confirm that this is unexpected behaviour. Our developers are aware of this issue and are currently investigating this. As at now, I don't have a timeline for when a fix would be shipped to fix this bug but I will let you know immediately I get  any updates on this issue.

In the meantime, I would suggest making an additional after you receive the webhook using the Orders GraphQL Admin API to query orders associated with a customer. See below for an example query. In the sample I specify first:2 which tells the query to return the first 2 orders of the resultset; if the response contains more than one item, then the user's orders_count > 1

 

{
  orders(first:2, query:"email:user@example.com"){
    edges{
      node{
        email
        id
      }
    }
  }
}

 

I understand the inconvenience and I hope the above workaround works for what you're looking to do. If you have any questions or need me to clarify anything please let me know.

Best,
Seth.

syf_ | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes