Hi Dylan, this is defined in your Function’s shopify.extension.toml file. Under the [extensions.ui] for UI extensions and [extensions.ui.paths] property for embed apps (e.g. Remix).
Oh wow, thanks for the tip. I wasn’t expecting to find it there.
Multiple discount nodes can utilize the same Function correct?
But a Function’s toml can only define a single create/details UI path right?
Maybe I’m missing something, but it seems like then if a merchant creates multiple different versions of automatic app discount nodes, then the pathing can’t properly route to the different ones through a route param?
If you are using a UI extension, then Shopify Admin will deal with the create/edit routes. If you are using a Remix App, then you can use the :functionId and a :id parameter for example. The parameters can be decided by you in your Remix App’s routing setup.
[extensions.ui.paths]
create = "/discount/:functionId/new"
details = "/discount/:functionId/:id" -> The ID here is your discountId.
So in your app, this route file would be for example:
The documentation for the :id parameter wasn’t clear to me:
The :id is dynamically replaced by the ID of the function owner.
Specifically the “function owner” phrase to describe a discount node confused me. I wasn’t sure what a function owner was.
So now we can create a dedicated details page for editing a discount node, even if the merchant creates multiple discounts from the same function. Beautiful!