Graphql - Get total line item price of order

DDLS
New Member
7 0 0

Hello ,

i am trying to get the list of items of particular order with total line item price.

Below this query i'm using :-

{
order(id: "gid://shopify/Order/order-id"){
currentTotalPriceSet{
shopMoney{
amount
}
}
lineItems (first: 10) {
edges {
node {
id
title
originalTotalSet {
shopMoney {
amount currencyCode
}
}
}
}
}
}
}

But i have get an error like that -

stdClass Object
(
    [errors] => Array
        (
            [0] => stdClass Object
                (
                    [message] => Field 'currentTotalPriceSet' doesn't exist on type 'Order'
                    [locations] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [line] => 3
                                    [column] => 3
                                )

                        )

                    [path] => Array
                        (
                            [0] => query
                            [1] => order
                            [2] => currentTotalPriceSet
                        )

                    [extensions] => stdClass Object
                        (
                            [code] => undefinedField
                            [typeName] => Order
                            [fieldName] => currentTotalPriceSet
                        )

                )

        )

)
0 Likes
HunkyBill
Shopify Expert
4355 36 462

Where in the schema do you see currentTotalPriceSet for an order? I see totalPriceSet but nothing with current.

Try asking for just totalPriceSet.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes
DDLS
New Member
7 0 0

Thank you everyone for reply me , 

I have tried totalPriceSet but it didn't gave me exact response which i want ,
I want to get total price of line item product for an order.

Please help if any idea how i do it?

0 Likes
HunkyBill
Shopify Expert
4355 36 462

I don't work off ideas but instead, I examine the schema which actually gives me the answer, so there is no wasting time with guessing.

A line item has a couple of properties you can use like totalDiscountSet and originalTotalSet that concern pricing. There are a couple of others. If you really want to know the gory details, dive into the schema and you'll be a happy camper. Since tools can assist you in your work, like the wheel, hammers, or ladders, try Insomnia for GQL work. It is super and will save you oodles of time.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes