Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is probably a general commerce rules question but I am struggling to find the correct approach for registrations. Can any body help?
My use case is for after-school clubs where registrations for additional siblings receive a discount. For example the first slot is priced at $3.00 and each additional slot is $2.50
Ideally I would like to calculate the correct values for each registration when they are added to the cart.
Any suggestions please?
Comments
Comment #2
gcbYou can do this in PHP in hook_registration_commerce_calculate_price: the Registration is tied to a Line Item, which is tied to a Cart where you can count the existing registrations.
There is currently no trivial way to do this with configuration, I'm afraid. The Commerce Discount module might be able to do this, however, by creating a rule that generates discounts based on the number of items purchased.
Comment #3
MrPaulDriver CreditAttribution: MrPaulDriver commentedI eventually go this working with rules, but is was prone to rounding glitches.