Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

issue deploying product-discount function "function not found"

Solved

issue deploying product-discount function "function not found"

matoow
Shopify Partner
15 1 9

 

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:-
 
Accepted Solution (1)
matoow
Shopify Partner
15 1 9

This is an accepted solution.

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

View solution in original post

Replies 6 (6)

SBD_
Shopify Staff
1831 273 423

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 🤔

 

Scott | Developer Advocate @ Shopify 

matoow
Shopify Partner
15 1 9

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

SBD_
Shopify Staff
1831 273 423

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

Scott | Developer Advocate @ Shopify 

matoow
Shopify Partner
15 1 9

This is an accepted solution.

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

SBD_
Shopify Staff
1831 273 423

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

Scott | Developer Advocate @ Shopify 

laurence-ledger
Shopify Partner
1 0 0

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/shop...

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`