I am developing a training website using Drupal Commerce. The person can book a single slot every time and can add attendees(used field collection for dynamic rows) to the training slot. How Can I increase the Order total based on the people added in the form in checkout?

For Example, If the slot is 33 dollars per person then if I add two attendees in the checkout, automatically the quantity should increase and should change the order total.

I thought to try with rules, but I didn't get how to get the count of field collection items in the rule and increase the price.

Could anyone please suggest on this?

Thanks in Advance!!!


If you want to do this solely via Rules, then you'd likely need to write a custom Rules action that can count those attendees and apply an appropriate price adjustment to the unit price of the line item. If you want to bypass Rules completely, you can change your price calculation process to support module based alterations and write custom code that hooks into the sell price calculation process via hook_commerce_product_calculate_sell_price(). The challenge here is that you aren't getting these attendees until the checkout form, so you'll want to make sure the customer has a chance to review the final price before paying.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.