How can I get the final price (with price rules applied) of a CheckoutLineItem on Storefront API

dnlortz
New Member
2 0 0

I created a percentage price rule for all product if the user add two or more items to the cart. I can get the correct value with the applied discount on the "totalPrice" from the checkout but I'd like to display the final price next to the checkoutLineItem. I'm not sure how to query that value

 

this is the query that I'm making

 

query FetchCheckoutById($checkoutId: ID!) {
  node(id: $checkoutId) {
    ...CheckoutFragment
  }
}

fragment CheckoutFragment on Checkout {
  id
  webUrl
  completedAt
  totalTax
  subtotalPrice
  totalPrice
  lineItemsSubtotalPrice {
    amount
  }
  lineItems(first: 250) {
    edges {
      node {
        variant {
          id
          priceV2 {
            amount
          }
        }
        customAttributes {
          key
          value
        }
        quantity
      }
    }
  }
}
Reply 1 (1)
dnlortz
New Member
2 0 0

testing around a little more, I guess I can use the discountAllocation field and do the math myself, right? is there any other way to get the discounted value?