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 ) ) ) )
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.
User | Count |
---|---|
14 | |
12 | |
10 | |
8 | |
7 |