Tagging orders via GraphQL not always working

Highlighted
New Member
2 0 0

Hi,

We are working on a custom APP which will tag orders after certain actions. Basically, after we processed an order (transactional email integration with SalesForce) we want to assign a tag e.g. "email_order_create:xxxx" to the order. We using GraphQL mutation::tagsAdd endpoint to tag the order, which works but not consistent. 

We log response for each "tagsAdd" call, none of them indicates an error, but sometime the order is not tagged correctly (after the "success" tag adding response, we check the order in both admin and via get order API, the tag is not there even the response saying nothing in error), here is a few example add tag responses:

Tagging Status:
{
  tagsAdd: { node: { id: 'gid://shopify/Order/2160450175073' }, userErrors: [] }
}


Here is our request (API call)

# Query
mutation OrderTagsAdd($order_id: ID!, $order_tags: [String!]!) {
    tagsAdd(id: $order_id, tags: $order_tags) {
        node {
            id
        }
        userErrors {
            field
            message
        }
    }
}
# Variables
{
  "order_id": "gid://shopify/Order/2160450175073",
  "order_tags": ["email_order_create:2160450175073"]
}

Again, it's working but just not consistent, which make the trouble shooting hard since we are not able to identify what's causing the inconsistency. Can any one help or share some idea in how to trouble shooting this type of issue?


Thank you very much!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
491 97 88

Hey @yangli_1r 


I can help you troubleshoot this. When an order is not tagged, can you note the x-request-id from the header and post it back to me? That will help me see what is happening behind the scenes. Do you have any other flows that run that could introduce a race condition? 

Vix | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 


0 Likes