I'm working on a Craft Commerce project where users can register for paid events. The events have a different price for members and non-members of the organization the site belongs to. I'm not sure what the best way to represent this member discount is. My ideas:
- Create a discount that takes a fixed amount or percentage amount off, and use a Match Customer rule to only apply to users in the Member group. However, I need to build this discount into the system into several functions and templates, and it looks like you're not supposed to build around the assumption that a specific discount will always exist. Discounts aren't tracked in the project config, so a specific discount may or may not exist on the production site. I can use a migration to create the discount, but it can still be deleted. Discounts also don't have handles, so there isn't even a way to fetch a specific discount in a template to see whether it exists. I also need to show prices for members and non-members without the context of a cart, and there doesn't seem a simple way to do that, since discounts can only apply to orders or carts. Feels like this solution would require a lot of small hacks to deeply integrate into templates and functionality, doesn't feel like the best solution.
- Use product variants – each event gets a variant for members and one for non-members. I could use hooks to ensure only members can buy the member-only variant. However, this would require editors to manually add both variants for all events, which is error-prone and a lot of unnecessary work.
- Write a custom adjuster that discounts events for members automatically. This feels like the cleanest solution, but feels like a lot of work for a rather 'basic' requirement. I only want to try that once I'm sure there's no better solution.
- Use the Events plugin, which supports creating different tickets. This would probably work, but has some other issues that prevent me from using it (most prominently that it's still in beta for Craft 4).
Which of those approaches is the best? Is there a simpler solution that I'm not seeing? I think discounts are probably the intended way to handle this scenario, but how can I handle the problems mentioned above in this case?