Skip to main content
Log inSign up

Shopify uses cookies to provide necessary site functionality and improve your experience. By using our website, you agree to our privacy policy and our cookie policy.

Expose the discount class for applied_discounts and discount_allocations on a line item for the Checkout Admin REST API

The 2023-07 API version of the Checkout Admin REST API will expose the discount_class attribute in the line_items[n].applied_discounts and line_items[n].discount_allocations.

The discount_class identifies the type of discount applied to a line_item:

PRODUCT - denotes a Product class discount that applies to specific products only. ORDER - denotes an Order class discount that applies across all line items.

The following example shows the "discount_class": "ORDER" present for the line item when an order class discount was applied to a checkout.

"line_items": [
    {
        "id": "a93dfd7540730e5d9812a92fac5a640e",
        "key": "a93dfd7540730e5d9812a92fac5a640e",
        "product_id": 6,
        "variant_id": 10,
        "sku": "jeans1",
        "vendor": "",
        "title": "Jeans",
        "variant_title": "Black",
        "image_url": "",
        "taxable": true,
        "requires_shipping": true,
        "gift_card": false,
        "price": "50.00",
        "compare_at_price": "30.00",
        "line_price": "50.00",
        "properties": {},
        "quantity": 1,
        "grams": 0,
        "fulfillment_service": "manual",
        "applied_discounts": [],
        "discount_allocations": [
            {
                "id": null,
                "amount": "20.00",
                "description": "ORDER$20",
                "created_at": null,
                "application_type": "discount_code",
                "discount_class": "ORDER"
            }
        ],
        "tax_lines": []
    }
],
Was this section helpful?