Order APi

myvirtualteans
Shopify Partner
10 0 1

Hi,
I am using shopify order API to fetch details of order. I am  facing a issue right now. The issue is I created a order on shopify and then I removed the product from that order then added a new product and made the order . Now when I check in my shopify order section it shows me order has one product and one is removed  (Which is correct) and when I check in Shopify order Api it returns me two line_items one is for actual product with order and one is for product which I removed . My question is how can I distinguish between these 2 line_items that which one is for removed product and which one is for actual product with order.

Thank you

0 Likes
Greg_Kujawa
Shopify Partner
965 80 204

Here's a GraphQL API example where I query against an order, pulling the refund details as well as the refunded line items. Then I also pull the order line items, since the refundable quantity will show zero for an order line item that already has been refunded. Give this a try and it should offer the info you might need!

 

UPDATE: Oops, I realized now you meant removed, not refunded. Will check back in a bit, as this is obviously a misdirected reply on my part...lol.

 

 

{
  order(id: "gid://shopify/Order/2567440236706") {
    id
    name
    subtotalLineItemsQuantity
    totalPriceSet {
      presentmentMoney {
        amount
        currencyCode
      }
    }
    lineItems(first: 5) {
      edges {
        node {
          id
          title
          quantity
          refundableQuantity
          discountedTotalSet {
            presentmentMoney {
              amount
              currencyCode
            }
          }
        }
      }
    }
    refunds(first: 5) {
      id
      refundLineItems(first: 5) {
        edges {
          node {
            lineItem {
              id
              title
              quantity
              discountedTotalSet {
                presentmentMoney {
                  amount
                  currencyCode
                }
              }
            }
          }
        }
      }
    }
  }
}

 

 

 

0 Likes
Greg_Kujawa
Shopify Partner
965 80 204

Actually my original reply still holds true. The refundableQuantity field will show zero for anything that's been either removed or refunded. If you pull any refunded line items those will reflect any refundableQuantity order line items that are zero. Any other order line items with refundableQuantity = 0 that don't correspond with a refunded line item can be assumed as being removed.

0 Likes