Answers.Body: <p>I don't think there is a good solution in CiviCRM that will do this for you out of the box (Webform CiviCRM would, but that's Drupal). What I would do is have your set of radio buttons to select the room type, then add a numeric field for the total accommodation price, then use JavaScript to hide or disable that numeric field and then update it when the other relevant fields change. Someone could, of course, mess with the value of the field in the console so they don't pay as much, but that's probably not that likely.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-05-22T17:53:18.187Z
Answers.LastActivityDate: 2023-05-22T17:53:18.187Z
Answers.UserDisplayName: Lars SG
Body: <p>I am creating an online registration form for a paid event in CiviCRM (on WordPress). We provide several kinds of accommodation (with different prices and availability).</p>
  <p>I have figured out that I need a Price Set for things like electing specific meals.</p>
  <p>But I have an issue to set a Price Field for the accommodation. The total price for accommodation depends on 2 thing: 1) the type of room (different price for different types), 2) number of nights. For now I have created a price field with radio buttons for every room type. But it only uses the unit price, but not multiply it by number of nights...</p>
  <p>I have set a custom fields for arrival day and departure day, so I have the information about number of nights. But I do not know how to use it in order to automatically calculate the total price for accommodation. As the total price is shown during the registration and is send by email, I really prefer to have it calculated automatically and fully.</p>
  <p>As as temporal dirty quick fix I can set several price fields (one for each type of room) and let the registrees to type number of nights. But it is very dirty, confusing, not dumb-proof and redundant... Any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-05-22T19:40:48.570Z
Comments.Text: only cludgy way we have done something similar is to set the Price Set up so it has accommodation fields for each day. then folk have to click eg Friday - Double Room / Single Room / Dormitory (where the latter are each radio buttons) then again Saturday - Double Room / etc.
Comments.UserDisplayName: petednz - fuzion
Tags: <civievent><online-registration>
Title: Calculating price for accommodation in CiviEvent (room type * number of nights)
ThreadText: # Calculating price for accommodation in CiviEvent (room type * number of nights)
  
  (Asked by: username_0 on 2023-05-22)
  
  I am creating an online registration form for a paid event in CiviCRM (on WordPress). We provide several kinds of accommodation (with different prices and availability).
  
  I have figured out that I need a Price Set for things like electing specific meals.
  
  But I have an issue to set a Price Field for the accommodation. The total price for accommodation depends on 2 thing: 1) the type of room (different price for different types), 2) number of nights. For now I have created a price field with radio buttons for every room type. But it only uses the unit price, but not multiply it by number of nights...
  
  I have set a custom fields for arrival day and departure day, so I have the information about number of nights. But I do not know how to use it in order to automatically calculate the total price for accommodation. As the total price is shown during the registration and is send by email, I really prefer to have it calculated automatically and fully.
  
  As as temporal dirty quick fix I can set several price fields (one for each type of room) and let the registrees to type number of nights. But it is very dirty, confusing, not dumb-proof and redundant... Any ideas?
  
  **Tags:** civievent, online-registration
  
  > **Comments:**
  > **username_1**: only cludgy way we have done something similar is to set the Price Set up so it has accommodation fields for each day. then folk have to click eg Friday - Double Room / Single Room / Dormitory (where the latter are each radio buttons) then again Saturday - Double Room / etc.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2023-05-22. Score: 1 | Accepted answer
  
  I don't think there is a good solution in CiviCRM that will do this for you out of the box (Webform CiviCRM would, but that's Drupal). What I would do is have your set of radio buttons to select the room type, then add a numeric field for the total accommodation price, then use JavaScript to hide or disable that numeric field and then update it when the other relevant fields change. Someone could, of course, mess with the value of the field in the console so they don't pay as much, but that's probably not that likely.
  
  
  ---
  
  