Order sort key TOTAL_PRICE not providing expected results in queries

Shaibt
Shopify Partner
34 1 31

Seems that Admin API sort key TOTAL_PRICE is not resulting in correct responses from the Admin API.

Lets say I have a customer with the following orders - using this Admin API GraphQL query:

query ($customerId: ID!) {
      customer (id: $customerId) {    
        orders (first: 20) {
          nodes {
            displayFinancialStatus
            displayFulfillmentStatus
            totalRefundedSet {
              shopMoney {
                amount
              }
            }
            currentTotalPriceSet {
              shopMoney {
                amount
              }
            }          
          } 
        }
      }
    }

 Provides this result:

{
    "data": {
        "customer": {
            "orders": {
                "nodes": [
                    {
                        "displayFinancialStatus": "PAID",
                        "displayFulfillmentStatus": "FULFILLED",
                        "totalRefundedSet": {
                            "shopMoney": {
                                "amount": "0.0"
                            }
                        },
                        "currentTotalPriceSet": {
                            "shopMoney": {
                                "amount": "87.71"
                            }
                        }
                    },
                    {
                        "displayFinancialStatus": "PAID",
                        "displayFulfillmentStatus": "FULFILLED",
                        "totalRefundedSet": {
                            "shopMoney": {
                                "amount": "0.0"
                            }
                        },
                        "currentTotalPriceSet": {
                            "shopMoney": {
                                "amount": "13.52"
                            }
                        }
                    },
                    {
                        "displayFinancialStatus": "PAID",
                        "displayFulfillmentStatus": "FULFILLED",
                        "totalRefundedSet": {
                            "shopMoney": {
                                "amount": "0.0"
                            }
                        },
                        "currentTotalPriceSet": {
                            "shopMoney": {
                                "amount": "0.0"
                            }
                        }
                    },
                    {
                        "displayFinancialStatus": "PARTIALLY_REFUNDED",
                        "displayFulfillmentStatus": "FULFILLED",
                        "totalRefundedSet": {
                            "shopMoney": {
                                "amount": "59.17"
                            }
                        },
                        "currentTotalPriceSet": {
                            "shopMoney": {
                                "amount": "295.85"
                            }
                        }
                    }
                ]
            }
        }
    }
}

 

Now, trying to use the following query to get the customer's largest order - using TOTAL_PRICE sort key in reverse:

 

query ($customerId: ID!) {
      customer (id: $customerId) {    
        orders (sortKey: TOTAL_PRICE reverse: true first: 1) {
          nodes {
            displayFinancialStatus
            displayFulfillmentStatus
            totalRefundedSet {
              shopMoney {
                amount
              }
            }
            currentTotalPriceSet {
              shopMoney {
                amount
              }
            }          
          } 
        }
      }
    }

 

Yields an empty result:

{
    "data": {
        "customer": {
            "orders": {
                "nodes": []
            }
        }
    }    
}

 

Is this sort key valid and maintained in API ver 2022-04? It is documented as such.

 

Replies 0 (0)