Customer Segment Discount Codes Not Working

I am publishing an app using Shopify Functions.
There is an issue with coupon codes created by the app, and coupon codes using customer segments are not working.

Problem Details:
When applying the coupon on our checkout page (logged in using an eligible customer), I get the error: “discount code isn’t available to you right now"

Additionally, I have received the following feedback from multiple app users.

  • The code was working perfectly fine earlier, and suddenly stopped working last Wednesday.
  • This issue started on Friday, when shopify stated they experienced an outage.

I will share the data for the code.
API schema : Admin
API version : 2025-07

{
  "data": {
    "discountNode": {
      "discount": {
        "__typename": "DiscountCodeApp",
        "asyncUsageCount": 0,
        "appliesOnOneTimePurchase": true,
        "appliesOncePerCustomer": false,
        "appliesOnSubscription": true,
        "codesCount": {
          "count": 1
        },
        "combinesWith": {
          "orderDiscounts": false,
          "productDiscounts": false,
          "shippingDiscounts": false
        },
        "discountClasses": [
          "ORDER"
        ],
        "endsAt": null,
        "codeRecurringCycleLimit": null,
        "startsAt": "2026-02-23T18:58:22Z",
        "status": "ACTIVE",
        "title": "TEST000",
        "usageLimit": null,
        "customerSelection": {
          "__typename": "DiscountCustomerSegments",
          "segments": [
            {
              "id": "gid://shopify/Segment/597449638186",
              "name": "vip"
            }
          ]
        },
        "codes": {
          "edges": [
            {
              "node": {
                "code": "TEST000"
              }
            }
          ]
        }
      },
      "id": "gid://shopify/DiscountCodeNode/1585678647594"
    }
  }
}

The discount codes are functioning when set for all customers or specific customers.

I will share the x-request-id for checking the log at checkout.
x-request-id: c8041f96-9266-4b4a-8459-f624821b734c-1771878812

Using context instead of customerSelection to set discounts worked successfully.
However, since this change cannot be immediately reflected in the app, I would like it to also function with customerSelection.

1 Like

@Hirano,

I’ve been attempting to reproduce this issue but haven’t been able to so far.

Can you confirm if you’re still encountering this issue?
Can you create one discount with context, another with customerSelection, test the behavior at checkout, and share the request ID with me?

This issue is still occurring.
I will share the request ID.

Discount with customerSelection
x-request-id: 5b4a074e-02ba-4e38-883e-b2dc7f15caf5-1772111300

Discount with context
x-request-id: 5e968c96-dd47-4d39-96e1-cfc7986c36af-1772111380

Thank you. Based on the logs retrieved from those request IDs the issue occurred because of the customers input in the discountCodeAppCreate mutation.

    "customerSelection": {
      "all": false,
      "customerSegments": {
        "add": ["gid://shopify/Segment/1234"],
        "remove": []
      },
      "customers": {
        "add": [],
        "remove": []
      }
    },

The above indicates 1 customer segment and 0 customers. As a result, 0 customers are eligible for the discount.

I recommend excluding the customers input from your mutation unless you wish to specify specific customers.

1 Like