Discount app not connecting with shopify plus store

I have deployed my discount app on partner account. After that I have installed app on shopify store. But when I am running shopify app dev then I am getting below error.


pc@pc-ThinkPad-E15-Gen-4:/var/www/salt/apps/employee-discount-app$ shopify app dev
? Which store would you like to use to view your project?
:check_mark: saltbyideas.com

╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ The store you specified (saltbyideas-com.myshopify.com) is not a dev store │
│ │
│ Run dev --reset and select an eligible dev store. │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

I am badly stuck. How can I run this app on shopify plus live store.

I have installed the app, and its showing in live store.

But when I am trying to get app function ID

Endpoint: https://saltbyideas-com.myshopify.com/admin/api/2025-04/graphql.json

Query:

query {
shopifyFunctions(first: 10) {
edges {
node {
id
app{
title
}
}
}
}
}

Response

{
“data”: {
“shopifyFunctions”: {
“edges”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 10,
“actualQueryCost”: 2,
“throttleStatus”: {
“maximumAvailable”: 20000.0,
“currentlyAvailable”: 19998,
“restoreRate”: 1000.0
}
}
}
}

======
And trying to create discount automate

mutation {
discountAutomaticAppCreate(
automaticAppDiscount: {
title: “Employee Discount” # shown on cart page
startsAt: “2025-06-17”
functionId: “ddddd-bc59-41de-8b6f-dddd”
discountClasses: [PRODUCT]
}
) {
userErrors {
field
message
}
automaticAppDiscount {
discountId # GID for the Discount node
}
}
}

Response is:

{
“data”: {
“discountAutomaticAppCreate”: {
“userErrors”: [
{
“field”: [
“automaticAppDiscount”,
“functionId”
],
“message”: “Function not found.”
}
],
“automaticAppDiscount”: null
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 10,
“actualQueryCost”: 10,
“throttleStatus”: {
“maximumAvailable”: 20000.0,
“currentlyAvailable”: 19990,
“restoreRate”: 1000.0
}
}
}
}

I have got function Id from partner account app configuration of discount app.

Can anyone guide how I can create this discount using mutation with correct function app id.

Hi @Saroop_Chand

You are encountering the “Function not found” error because the functionId you are using is not correct for the discountAutomaticAppCreate mutation. Here’s how Shopify Functions and their IDs work:

Key Points

  1. FunctionId Source:
    The functionId required for discount mutations (like discountAutomaticAppCreate) must be the ID of a Shopify Function that is registered and published to the store, and specifically of the correct type (e.g., Discount Function).
  • The functionId you see in the Partner Dashboard or app configuration is NOT the one you use in the mutation.
  • You must use the functionId returned by the shop’s Admin API via the shopifyFunctions query.
  1. Empty shopifyFunctions Response:
    If your shopifyFunctions query returns an empty edges array, it means that no Shopify Functions are currently registered to your store. This can happen if:
  • The app was installed, but the function was not published to the store.
  • The function is not of the correct type (e.g., not a Discount Function).
  • There was an error during deployment or registration.
  1. How to Fix:
  • Make sure you have run shopify app deploy or shopify app function deploy after building your function.
  • Ensure your extension is of type “function” and targets the correct discount API (e.g., Discount Function, not a deprecated one).
  • After deployment, run the shopifyFunctions query again. You should see your function listed, with an id like gid://shopify/ShopifyFunction/1234567890.
  • Use this id as the functionId in your mutation.

How to Get the Correct functionId

  1. Deploy your function (from your app root):
    shopify app deploy

  2. Query for functionId:

   query {
     shopifyFunctions(first: 10) {
       edges {
         node {
           id
           app {
             title
           }
           apiType
           apiVersion
         }
       }
     }
   }
  • Look for a node with apiType like DISCOUNT or similar, and the correct app.title.
  1. Use the returned id in your mutation:
   mutation {
     discountAutomaticAppCreate(
       automaticAppDiscount: {
         title: "Employee Discount"
         startsAt: "2025-06-17"
         functionId: "gid://shopify/ShopifyFunction/1234567890"
         discountClasses: [PRODUCT]
       }
     ) {
       userErrors {
         field
         message
       }
       automaticAppDiscount {
         discountId
       }
     }
   }

Notes:

  • Do NOT use the function UUID from the Partner Dashboard.
  • Use the functionId returned by the shopifyFunctions Admin API query after deploying your function.
  • If the query returns no functions, your function is not registered to the store—deploy it again.

For more details, see the Shopify documentation on creating discount functions and registering functions.

If you follow these steps and still see an empty list, double-check your deployment process and ensure your app is installed on the store.

I tried all these but Its returning no response.

Can you look where I have done wrong

/var/www/salt/apps/employee-discount-fn/extensions/employee-discount-fn/shopify.extension.toml

api_version = “2025-04”

[[extensions]]
name = “t:name”
handle = “employee-discount-fn”
type = “function”

description = “t:description”
discount_type = “automatic”

[[extensions.targeting]]
target = “cart.lines.discounts.generate.run”
input_query = “src/cart_lines_discounts_generate_run.graphql”
export = “cart-lines-discounts-generate-run”

#[[extensions.targeting]]
#target = “cart.delivery-options.discounts.generate.run”
#input_query = “src/cart_delivery_options_discounts_generate_run.graphql”
#export = “cart-delivery-options-discounts-generate-run”

[extensions.build]
command = “”
path = “dist/function.wasm”

And

/var/www/salt/apps/employee-discount-fn/shopify.app.toml

Learn more about configuring your app at App configuration

client_id = “6f5dcdb3fa983bc8aade12459eb7aedd”
name = “employee-discount-fn”
handle = “employee-discount-fn”
application_url = “Find this app in the pages where you work
embedded = true

[build]
include_config_on_deploy = true
automatically_update_urls_on_dev = true

[webhooks]
api_version = “2025-04”

[access_scopes]

Learn more at App configuration

scopes = “write_products”

[auth]
redirect_urls = [ “https://shopify.dev/apps/default-app-home/api/auth” ]

[pos]
embedded = false

AS I tried to run to get the function Id
The result function ID is not returning.


Hi @Liam-Shopify can you guide me where I am doing wrong.

Any Help? as it’s currently blocked from going live and we are stuck to go live. Please