What's your biggest current challenge? Have your say in Community Polls along the right column.
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.

Unable to query `refundLineItems` from Orders endpoint using Bulk GraphQlL

Unable to query `refundLineItems` from Orders endpoint using Bulk GraphQlL

vk101
Tourist
4 1 5

I'm unable to retrieve Refunded LineItems from an Order using the bulk api.

I get the following error:
"Queries that contain a connection field within a list field are not currently supported."

 

I don't want to use Refund endpoint in Bulk GraphQl to get the refund line items because it requires `refund id` and it will slower down the process by first fetching all the ids of refunds and then querying them individually.

Below is the query I'm using:-

mutation {
  bulkOperationRunQuery(
   query: """
    {
    	orders(query: "updated_at:>'2020-01-01T05:39:32Z' AND updated_at:<'2020-07-29T06:14:15Z'") {
	    edges {
	      node {
	        id
	        name
	        createdAt
	        updatedAt
	        shippingLine{id}
	        taxesIncluded
	          refunds {
	            id
	            createdAt
			        updatedAt
	            totalRefundedSet{shopMoney{amount, currencyCode}}
              
              refundLineItems(first:10)
              {
                 edges
                {
                  node
                   {
                
                      location
                    {
                       name
                    }
                subtotalSet{shopMoney{amount}}
                    quantity
                  }
                }
              }
                

                
              
	          }
	      }
	    }
	  }
	}
    """
  )
    {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}
Reply 1 (1)

TX-Aggie
Tourist
6 0 1

I am also curious about this.  Transactions do not show how much of the refund is attributed to sales tax and while that data is broken down on a line item (AMOUNT - TAX) to infer the refunded tax amount, only a refund line item shows which order line item it references.  It seems there is no way via GraphQL bulk API to tie out the necessary data for metrics that are clearly shown on Shopify's own reporting.  Unless I am missing something, this seems like a design flaw in either the back-end structure or the GraphQL API.

 

So is there a better way to retrieve refunds broken out by product price and sales tax (i.e. net sale vs total sale for an order?

 

Thanks,

Scott