Issue deploying product-discount function "function not found"

Hey, we are in the process of creating a shopify store, and have developed a cart validation function similar to https://shopify.dev/docs/api/functions/reference/cart-checkout-validation and a product discount function similar to https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started.

Both functions are part of an ‘app’ that I’ve developed under a partner account linked to the same organisation.

Both functions run fine in my development store.

However, when deploying it to our live store (currently on a basic plan) the cart validation works, but the product-discount does not.

I have copied the client credentials for the app, created an access token, and verified that the product discount function is present on the store via the graphql interface, but when I try to CREATE the discount via graphql as per step 4 in the tutorial above, it returns ‘function not found’.

I am wondering if this could be related to the fact that the store I’m deploying to is on the basic and not the plus plan as it suggests is required. However, the cart-validation function is executing and working as expected on the same store.

  • Do I need to have a plus store to run the cart-validation function?
  • Could this be the issue with the deployment of product-discount? Or something else?

There is some further information here:-
https://community.shopify.com/c/shopify-functions/admin-graphql-api-discountautomaticappcreate-mutation-quot/m-p/2393693#M1379

Hey @matoow

Thanks for all the details. Looks like a plan issue:

Only stores on a Shopify Plus plan can use custom apps that contain Shopify Function APIs.

This would explain the function working in your development store but not the (basic) store. Curious that the cart validation function is working :thinking:

Hey Scott,

Many thanks for the reply. I’d really appreciate knowing if my cart validation function is supposed to work on a basic plan. I’m wondering if I’ve somehow managed to get an illegal setup, because the documentation states:-

Shopify Plus

Only custom apps on the Shopify Plus plan can use the Cart and Checkout Validation API.

https://shopify.dev/docs/api/functions/reference/cart-checkout-validation

I notice that in the https://partners.shopify.com/ site the app is down as a ‘custom’ app.

Would you happen to know how I go about getting a definitive answer to this? I have tried asking customer services, but they have directed me here.

Any help appreciated.

Thanks,

Matt

Checking with the Functions team - can you please DM me your (basic plan) store URL?

Really appreciate the help and the quick response. Have DM’d you.

For anyone following along - this was a bug on our end (some functions were running on Basic plans). This has now been resolved.

I’m hitting into an error when building the Rust function from this Tutorial page:
https://shopify.dev/docs/apps/selling-strategies/blockchain/tokengating/build-a-tokengating-app/shopify-function-gate-reaction

Is it related or should I open a separate issue?

This one seems easy to fix by renaming to shopify_function:

#[shopify_function_target(query_path = "src/run.graphql", schema_path = "schema.graphql")]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: an attribute macro with a similar name exists: `shopify_function`

Then there are a host of issues with output and input that I’m not sure how to solve:

discount_application_strategy: output::DiscountApplicationStrategy::FIRST,
| ^^^^^^ use of undeclared crate or module `output`
Some(input::InputDiscountNodeMetafield { value }) => Configuration::from_str(&value),
| ^^^^^ use of undeclared crate or module `input`