Discount Type & Line-Item Discount Details

Dear Shopify Support Team,

We are using the LookUp API to fetch details on a line-item basis. However, for some line items, we are not receiving the discount code, even though it exists in Shopify. This information is crucial for categorization and, if missing, leads to discrepancies in our net sales reporting.

  • We have attached relevant screenshots highlighting the issue.

  • We have also attached the reference document which indicates that this method should resolve the problem.

While the API is returning results for some line items as expected, the issue is inconsistent — for certain line items the discount codes are fetched correctly, but for others they are not.

This appears to be a defect in the API itself, as the behavior is not uniform. Request you to kindly review and fix this issue at the earliest.

Hi @saravanan_gr

Can you share the screenshots you mentioned? Also how are you fetching line-item details? Querying an order should get you the discountApplications, eg:

query GetOrderLineItemDiscountCodes {
  order(id: "gid://shopify/Order/1234567890") {
    id
    lineItems(first: 10) {
      edges {
        node {
          id
          title
          discountAllocations {
            allocatedAmount {
              amount
              currencyCode
            }
            discountApplication {
              __typename
              ... on DiscountCodeApplication {
                code
              }
              ... on ManualDiscountApplication {
                title
              }
              ... on ScriptDiscountApplication {
                title
              }
              ... on AutomaticDiscountApplication {
                title
              }
            }
          }
        }
      }
    }
  }
}

Thanks, Mr. @Liam-Shopify , Let me check.

Are you still seeing this issue @saravanan_gr ?

Hi Liam,

Sorry for not following up,

We are currently using the same GraphQL as you mentioned

FYR

query = f"""

{{

  order(id: "{order_id}") {{

    id

    name   # order number like #1001

    lineItems(first: 50) {{

      edges {{

        node {{

          id

          title

          quantity

          variant {{

            id

            sku

          }}

          product {{

            id

          }}

          originalTotalSet {{

            shopMoney {{ amount currencyCode }}

          }}

          discountAllocations {{

            allocatedAmount {{

              amount

              currencyCode

            }}

            discountApplication {{

              \__typename

              ... on DiscountCodeApplication {{

                code

              }}

            }}

          }}

          discountedUnitPriceAfterAllDiscountsSet {{

            shopMoney {{ amount currencyCode }}

          }}

        }}

      }}

    }}

  }}

}}

"""

Issue: We are seeing line-item-wise discounts, but that is not consistent For example:

In shopify:

But via API:

But we can able to see discount codes for some other items by using GraphQL