Missing Delivery Address in GraphQL input

Topic summary

Issue: Developers are unable to retrieve delivery/shipping address data in the GraphQL input for Shopify discount functions (specifically order discount functions). The deliveryAddress field appears inconsistently or is missing entirely during the discount calculation process.

Context:

  • One user is building a “Free Gift” discount based on shipping address using GraphQL
  • Shopify Functions run multiple times during checkout (cart view, customer information step, shipping address step)
  • The delivery address is only provided in certain steps, but Shopify applies only the last discount run
  • This prevents proper qualification of discounts that depend on shipping address data

Current Status:

  • Multiple users confirm experiencing the same problem
  • One user mentions seeing a forum post (now unfindable) suggesting this is a known Shopify bug that has been flagged for fixing
  • Shipping discount functions can retrieve the data successfully, but order discount functions cannot using identical queries

Unresolved: No workaround or official fix has been identified. Users are seeking configuration options or solutions to access delivery address data consistently across all function execution steps.

Summarized with AI on November 18. AI used: claude-sonnet-4-5-20250929.

I’m building a discount based on GraphQL called Free Gift based on the shipping address. Currently, I’m facing a problem with the DeliveryOutput field in the GraphQL input query. I’ll explain the detail below.

How do I think Shopify Function works? Shopify will run multiple times at the specific event to calculate the discount such as View Cart, Customer Infomation step, and Shipping Address step. Every run will have an input for me to qualify whether the cart info is valid.

For the discount that I’m working on, I need Delivery Address info in the input to qualify for the discount, but the Shopify function only sends in one of those steps I have listed above. Here are some videos and images to help you easier to understand the problem.

Shopify will only apply the last discount run, even if cart info is valid for the discount. Is there any way I can config or fix this issue?

Thank you!

July 6, 2023 at 10:13:05 AM

===============================================INPUT===================================================
{
  "presentmentCurrencyRate": "1.0",
  "cart": {
    "deliveryGroups": [
      {
        "deliveryAddress": {
          "address1": "Test",
          "city": "New York",
          "countryCode": "VN",
          "provinceCode": null,
          "zip": "700000"
        }
      }
    ],
    "cost": {
      "subtotalAmount": {
        "amount": "150.0"
      }
    },
    "lines": [
      {
        "id": "gid://shopify/CartLine/0",
        "quantity": 1,
        "cost": {
          "subtotalAmount": {
            "amount": "150.0",
            "currencyCode": "USD"
          }
        },
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid://shopify/ProductVariant/45255130710328",
          "product": {
            "id": "gid://shopify/Product/8318842765624",
            "handle": "short-leeves-t-shirt",
            "productType": "general",
            "vendor": "xxx",
            "isGiftCard": false
          },
          "sku": "10"
        }
      }
    ]
  },
  "discountNode": {
    "metafield": {
      "value": "{\"selectCartBy\":{\"name\":\"ZipCodeQualifier\",\"inputs\":[\"does\",\"match\",\"[\\\"700000\\\"]\"]},\"selectLineItemBy\":{\"name\":\"none\",\"inputs\":[]},\"discount\":{\"name\":\"PercentageDiscount\",\"inputs\":[\"50\",\"\\\"Test\\\"\"]}}"
    }
  }
}

===============================================OUTPUT===================================================
{ "discountApplicationStrategy": "FIRST", "discounts": [ { "targets": [ { "productVariant": { "id": "gid://shopify/ProductVariant/45255130710328", "quantity": 1 } } ], "value": { "percentage": { "value": "50" } } } ] }

July 6, 2023 at 10:13:06 AM

===============================================INPUT===================================================
{
  "presentmentCurrencyRate": "1.0",
  "cart": {
    "deliveryGroups": [],
    "cost": {
      "subtotalAmount": {
        "amount": "150.0"
      }
    },
    "lines": [
      {
        "id": "gid://shopify/CartLine/0",
        "quantity": 1,
        "cost": {
          "subtotalAmount": {
            "amount": "150.0",
            "currencyCode": "USD"
          }
        },
        "merchandise": {
          "__typename": "ProductVariant",
          "id": "gid://shopify/ProductVariant/45255130710328",
          "product": {
            "id": "gid://shopify/Product/8318842765624",
            "handle": "short-leeves-t-shirt",
            "productType": "general",
            "vendor": "xxx",
            "isGiftCard": false
          },
          "sku": "10"
        }
      }
    ]
  },
  "discountNode": {
    "metafield": {
      "value": "{\"selectCartBy\":{\"name\":\"ZipCodeQualifier\",\"inputs\":[\"does\",\"match\",\"[\\\"700000\\\"]\"]},\"selectLineItemBy\":{\"name\":\"none\",\"inputs\":[]},\"discount\":{\"name\":\"PercentageDiscount\",\"inputs\":[\"50\",\"\\\"Test\\\"\"]}}"
    }
  }
}
===============================================OUTPUT===================================================

{ "discountApplicationStrategy": "FIRST", "discounts": [] }

1 Like

I’m facing the same issue, have managed to retrieve the input data fine with a shipping discount function but attempting the identical query for an order discount function is failing to return shipping address data.

I saw in another forum post (which I can’t find now ofc…) that this is a Shopify bug that has been flagged to be fixed. Any one know of an update on this?

1 Like