Extension only apps - deployment process

Hi all,
The issue is with regards to deployment of the extension-only-app

This is the process I followed:

  • Create an extension-only app with: npm init @Shopify_77 [email removed]

  • generated ( product discount ) extension: npm run shopify app generate extension

  • Testing store get everything working ( run mutation to create discount app etc. )

  • npm run deploy

  • On shopify partners

  • go to app and create a distribution

  • copy link and install on store ( I am installing on a plus store )

On the store when click on create a discount code I see that there is and extra option. Which seems correct as it created the same on the test store.

But products just are not discounted according to the conditions I setup in the product-discount function

I tried throwing an error in the shopify function, I assume it should show a notification in the store that a error is occuring with an app. But this is also unsuccessful

Am missing something with regards to the deployment process?

Any help will be appreciated.

Did you register your function with GraphiQL?

Get your functions:

query {
  shopifyFunctions(first: 25) {
    nodes {
      app {
        title
      }
      apiType
      title
      id
    }
  }
}

Register the function:

mutation {
  discountAutomaticAppCreate(automaticAppDiscount: {
    title: "Volume discount",
    functionId: "YOUR_FUNCTION_ID_HERE",
    startsAt: "2022-06-22T00:00:00"
  }) {
     automaticAppDiscount {
      discountId
     }
     userErrors {
      field
      message
     }
  }
}

Make sure GraphiQL has all the permissions it needs, including write_discounts.