- Issue created by @lhubbert
- 🇺🇸United States john.oltman
Currently any solution to this would require a custom module. As you figured out, doing separate variations for the adult and child tickets creates the issue that they each have their own registration cap instead of sharing one cap. One thought is to use a single variation but with a field on the order item used for add to cart that the user selects for adult vs child - you then setup a custom condition in your module based on that field that you can then use to drive a discount for the child. Another option is a field on the variation, you then create a custom price resolver in your module that looks at the field. Custom code any way you slice it - at least right now. In the future, I could see a new submodule of registration perhaps named registration_settings_group that allows N variations to share a single settings entity - which means multiple variations could share the same cap.
- 🇮🇳India bunty badgujar Delhi
Hello @john.oltman,
I have a similar requirement for my project, so I developed a sandbox module( https://www.drupal.org/sandbox/bbadgujar/3454345 → ) to make capacity global across product variants. I utilized a new boolean field, ConstraintValidator, and EventSubscriber to achieve this functionality. I would appreciate it if you could review the sandbox and provide feedback on whether this approach can be aligned with the feature development of the Commerce Registration module.
- 🇺🇸United States john.oltman
Thank you for the sandbox, I will try this out soon. Looks promising from my initial peek!
- Assigned to john.oltman
- 🇺🇸United States john.oltman
@bunty, your module is working nicely for me, thank you again.
At this time I am pursuing a different approach to this general problem in https://www.drupal.org/project/registration/issues/3419239 ✨ Establish host variations as an architectural concept Active that would provide a more flexible solution than yours (for example, supporting not only capacity but other registration related attributes as "global"). I will post a note here once the more general purpose solution is available.
- 🇮🇳India bunty badgujar Delhi
Hello @john.oltman,
Thanks for the review.
We are currently developing an event management website with a focus on global capacity. I would like to inquire whether we might encounter any difficulties updating this module once your solution for global configuration is ready, especially if we implement it using my sandbox module. Thanks in advance
- 🇺🇸United States john.oltman
Go ahead with the sandbox module, the timeline for the other solution is unclear, and the data change introduced by your module is small (one new boolean).