According to this page, https://shopify.dev/docs/apps/build/discounts/ux-for-discounts I should be able to
Adding simple form inputs to the discount page that manage metafields owned by the discount. Your UI extension is inserted into the discount details page.
However, there is no target specified for this. There only seems to be access via a discount function which seems to be for opening logic to discounts from a customer perspective. I only need to update and manage metadata for discounts in the admin portion. There seems to be no way to do this outside of a discount action. Is this correct?
So, from what I can get from the docs, there is no way to add a admin only metafield to discounts without a discount function. So I had to make a dummy function that does nothing to get the metafield to show up on the discount details page.
This seems incredibly silly I would like to know if I’m just being totally dumb with this but, I can’t figure out another way to add a admin only metafield to Discounts.
@Fred_Blueshoon , just curious - what would be the use of adding metadata to discounts if we’re not planning to use it to change the discounting logic? And the discounting logic can only be modified using a function. I guess I’m just wondering what the use case is for extending only the admin UI for discounts.
I think there are valid admin/reporting-only use cases for discount metafields, even when the metafield is not used by the discount logic itself.
For example, an app might generate a custom GraphQL-based accounting report and need discount-level metadata such as:
- invoice note
- internal reporting category
- accounting/customer classification
- campaign owner
- reconciliation notes
Those values do not necessarily need to affect checkout behavior. They may only need to be managed by staff in the admin and read later by a reporting/export workflow.