Discount in commerce webform
I am using commerce webform to create an event ticket. There is a question in the webform asking whether the participant has already attended the previous event? IF he selects YES, will ask for his attendee number and should provide 10% discount of the price. Tried to create rule but struck about how to implement with webforms. Please advise.
Changing the price using ajax
Changing the price using ajax is outside the scope of rules. But, if you wanted to add a price calculation that looks for a ticket that has been purchased by a past attendee based on their webform answers, I would simply create a price calculation rule that finds the webform entity based on the product and the user and then adjust the price by multiplying by 0.9 and calling it a discount.
This price would be reflected in the cart and the checkout in the "Discount" pricing attributes.