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.

total line item price for graphQL

total line item price for graphQL

MeasuredInc
Shopify Partner
14 0 2

Hello, I am trying to get total_line_item_price on Orders from Shopify's Admin GraphQL API but couldn't find any fields that will give this value. Previously I was using REST API and in response, I used to get "total_line_items_price". 

Is there any way we can get this value in GraphQL?

 

Also upon looking at the data from REST API, I saw that if I add "subtotal_price" and "total_discount" gives the exact number when compared with "total_line_item_price" with some discrepancies in very few cases.

Is this the right way to calculate "total_line_item_price"?

I am using the below query -

mutation {
  bulkOperationRunQuery(
    query: """
      {
          orders(query: "created_at:>[[DATE]] created_at:<[[DATE]]"){
              edges {
                  cursor
                  node {
                      id
                      name
                      createdAt
                      updatedAt
                      cancelReason
                      totalPriceSet{
                          presentmentMoney{
                              amount
                              currencyCode
                              }
                             shopMoney{
                                  amount
                                  currencyCode
                                  }
                }
                subtotalPriceSet{
                    presentmentMoney{
                        amount
                        currencyCode
                    }
                    shopMoney{
                        amount
                        currencyCode
                    }
                }
                totalDiscountsSet{
                    presentmentMoney{
                        amount
                        currencyCode
                    }
                    shopMoney{
                        amount
                        currencyCode
                    }
                }
                displayFinancialStatus
                displayFulfillmentStatus
                billingAddress{
                    zip
                    city
                    country
                    countryCodeV2
                    province
                    provinceCode
                }
                totalShippingPriceSet{
                    shopMoney{
                        amount
                    }
                }
                tags
                cancelledAt
                processedAt
                cancelReason
                currencyCode
                closedAt
                currentSubtotalPriceSet{
                    presentmentMoney{
                        amount
                    }
                    shopMoney{
                        amount
                    }
                }
                currentTotalDiscountsSet{
                    presentmentMoney{
                        amount
                    }
                    shopMoney{
                        amount
                    }
                }
                currentTotalPriceSet{
                    presentmentMoney{
                        amount
                    }
                    shopMoney{
                        amount
                    }
                }
                currentTotalTaxSet{
                    presentmentMoney{
                        amount
                    }
                    shopMoney{
                        amount
                    }
                }
                lineItems {
              edges {
                node {
                  title
                  quantity
                  variant {
                    title
                    price
                  }
                }
              }
            }
                physicalLocation{
                    id
                    name
                }
                paymentGatewayNames
                channel {
                    id
                    name
                }
                publication {
                    id
                    name
                }
                customerJourney { 
                    moments 
                    { ...on CustomerVisit 
                    { utmParameters 
                    {source, medium, campaign, content, term} } } } 
            customer{ id }
            }
        }
      }
      }
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

Replies 0 (0)