Have your say in Community Polls: What was/is your greatest motivation to start your own business?
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.

Extension Product Discount works on dev, but not on production

Solved

Extension Product Discount works on dev, but not on production

syanaputra
Shopify Partner
2 0 0

Hi, I am currently developing a custom app that creates an automated discount using `discountAutomaticAppCreate` and facing issue when deploying.

 

Summary:

  • LIVE site is using Shopify Plus Enterprise Platform
  • Extension is written using Typescript with API version 2023-10
    (Tried it with 2023-07 but still facing the same issue)

Everything works fine in the DEV environment, I can see that the Extension Log is firing perfectly fine.

 

syanaputra_0-1697114458387.png

 

However, it doesn't work in the LIVE environment which is on Shopify Plus Enterprise Platform Plan.

 

I have done the following steps for deployment:

  • Deployed it to the LIVE environment via CLI using `shopify app deploy`
  • Installed the app via the Distribution Link on Shopify Partner
  • Create the automatic discount using `discountAutomaticAppCreate` GraphQL pointing to the correct extension function ID.
    syanaputra_3-1697114648723.png
    syanaputra_2-1697114601052.png

When I go to the LIVE environment, adding an item to the cart doesn't send any log to the function.

If I understand it correctly, it should trigger as long as the app is installed and discount is available.

 

I've checked the other thread that mentioned Draft Checkout, and I can confirm that the Checkout is currently LIVE.

 

syanaputra_4-1697114792443.png

 

Are there any steps that I've missed?

 

Any help will be appreciated.

Thank you so much.

Accepted Solution (1)

Nick_Wesselman
Shopify Staff
171 43 73

This is an accepted solution.

Hi @syanaputra --

Not seeing success run logs for a production shop is expected, as noted in function docs. So it could be either that your function isn't executing for some reason, or it is running but it's not outputting any discounts.

Since you have the checkout editor available, I assume you are not on checkout.liquid in this Plus shop, which would stop the function from running. If the shop previously used checkout.liquid, it could be that discount combinations / extensible discounts are not enabled. Merchant support for the Plus shop can check on this.

You can also try initiating a hard crash in your function code (throw in JavaScript, panic! in Rust), which would appear in your run logs and could be shared from the discount admin.

-Nick

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

View solution in original post

Replies 2 (2)

Nick_Wesselman
Shopify Staff
171 43 73

This is an accepted solution.

Hi @syanaputra --

Not seeing success run logs for a production shop is expected, as noted in function docs. So it could be either that your function isn't executing for some reason, or it is running but it's not outputting any discounts.

Since you have the checkout editor available, I assume you are not on checkout.liquid in this Plus shop, which would stop the function from running. If the shop previously used checkout.liquid, it could be that discount combinations / extensible discounts are not enabled. Merchant support for the Plus shop can check on this.

You can also try initiating a hard crash in your function code (throw in JavaScript, panic! in Rust), which would appear in your run logs and could be shared from the discount admin.

-Nick

Nick Wesselman | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

syanaputra
Shopify Partner
2 0 0

Hi @Nick_Wesselman,

 

Thank you so much! That doc is something that I totally missed which caused the confusion on my end.

 

It turns out that the function was attaching properly, but my logic was flawed causing it to not run properly.

 

For anyone who probably has the same confusion as me:

Based on this doc: https://shopify.dev/docs/apps/functions/testing-and-debugging#debugging-functions-in-production


Only function failure logs shared by users are available in your Partner Dashboard.

In other words, the "Success" logs will never be available in production. Only the failure logs (and need to be shared by the store owner).