Extension only discount function works in dev, but not applied in production store

I am a corporate developer, new to Shopify, with a Shopify Plus Enterprise Platform Plan plan.

I followed the discount function tutorial (explicitly), https://shopify.dev/docs/apps/selling-strategies/discounts/experience/getting-started, though Step 5: Test the product discount. Remix app template WAS NOT SELECTED as I would like to keep an extension only function that does not require hosting custom pages in production.

Everything worked/tested great on the dev store and the discount was properly applied as indicated by code (i.e. applied when purchasing 2 or more of a product).

Next, I ran npm run deploy and switched over to the partner portal.

From Shopify Partners > Apps > Choose distribution > Custom distribution, I received an install link and ran it in my browser to install on ,my company’s production store. The app seems to have installed properly.

Then, I ran the [same as my dev store] mutation through GraphiQL App on my production store and the mutation [add discount] was created without ‘userErrors’

And appears to be added and active in the Discounts listed for the store.

However, when reviewing the cart, no discount is added for multiples of items.

  1. Are there any permissions or code necessary for a production environment that is not needed in the dev environment (for an extension only app)?

  2. How do you debug these differences in the production environment?

Hello :waving_hand:

I would recommend reviewing the Functions logs to determine if your function is being called, and if it is returning the data that you expect.

Your function logs can be found in the Partner Dashboard. Your App Name > Extensions > Your Function Name > See details.

1 Like

After reviewing the Functions logs to determine if the function is being called, I can see the response from the dev store, but

The function is NOT being called from my production store (even though it is installed). Is there more that needs to be configured on the production store than pictured above?

Is the Production store you are testing on, on the Shopify Plus plan? Only stores on the Shopify Plus plan can use Shopify Functions with custom apps.

Yes, our company sites are all on the Shopify Plus Enterprise Platform Plan plan.

Thank you for verifying that! I would recommend reaching out to Shopify Plus support to confirm that your Plus Store set up is compatible with Shopify Functions and Checkout Extensibility.

1 Like

Answer is to review the Checkout settings for the production store and see that the checkout is published, not draft. In order to complete the upgrade to checkout extensibility you need to publish a checkout. Navigate to Settings > Checkout and publish the Draft checkout then test the function again.

I have been having some issues with trying to test some Shopify functions. The functions work on the development stores (I have tested them all on 3 different dev stores). The checkout UI extensions work on both the dev store and the live store. the live store I am moving over to use checkout extensibility instead of the checkout.liquid file. So I have a draft checkout that I am testing everything on. I made the draft store and then go to preview from the draft checkout. The checkout UI extensions work there but not any of the functions. the functions are not even firing at all on the live store. I just wanted to verify that even though the discounts are installed on the store and using a preview of the draft checkout, The functions still will not work until the new checkout is published?

You mention: using a preview of the draft checkout

Answer is: review the Checkout settings for the production store and make sure that the checkout is published, not draft.