Answers.Body: <p>The short answer to my question (after discussion with CiviCRM and webform_civicrm devs) is that quick config price sets were designed for single line item contributions, webform_civicrm uses quick config for all contributions as there's no better alternative. So currently there is an unresolved compatibility issue with tentative plans to change Civi core to be more flexible. The triaged issue on the core repo is <a href="https://lab.civicrm.org/dev/core/-/issues/4698" rel="nofollow noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-11-03T11:41:34.230Z
Answers.LastActivityDate: 2023-11-03T11:41:34.230Z
Answers.UserDisplayName: Aiden
Body: <p>In a Drupal 7 site we are using webform_civicrm for paid event registrations. The webform creates the contribution with the participant fee (civicrm_participant line item) as well as other additional (civicrm_contribution) line items. All is well until one goes to the edit form of the contribution and saves, this recalculates the total amount and tax amount and only includes the first line item (participant fee). Occasionally other line items have been manually added to the contribution with the line item edit extension and those are also civicrm_participant line items, but also ignored.</p>
  <p>I did some digging in the civi core code. In the contribution edit submit function it looks as if only civicrm_participant line items are fetched if the contribution is recognised as a participant contribution. And while all the participant line items are added to the $params array, if the price set is quick config it seems deliberate that only the first one is used for the total amount and tax amount. All of our webform_civicrm generated line items fall under the reserved quick config price set 1.</p>
  <p>I ended up using some code to check and correct total_amount, tax_amount and net_amount in a hook_civicrm_pre implementation, but I would love it if someone could shed some light on where the fault lies here.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-25T18:11:12.960Z
Comments.Text: Can you clarify ? How do you define the contribution line items in webform ? How is your event price set up ?
Comments.UserDisplayName: samuelsov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T16:42:46.123Z
Comments.Text: I'm not sure what you're asking, webform_civicrm provides the line item and participant fee fields after enabling them, the values (prices) are assigned through conditionals in this case. The webform_civicrm code uses the default quick config price set for the line items. I'd imagine any participant contribution which is_quick_config and has multiple line items would have this issue regardless of any other factors.
Comments.UserDisplayName: Aiden
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:17:49.400Z
Comments.Text: Quick config depend on how you define the prices on your event. If you haven't done a priceset, it will be quickconfig but you can change that and webform should use whatever you have on your event.
Comments.UserDisplayName: samuelsov
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-28T08:03:21.370Z
Comments.Text: Looking at the code I don't think that's true, it uses 'default_contribution_amount' unless there's a membership id in which case it uses 'default_membership_type_amount'. I checked it out and found we do have the event set up with a price set which is not quick config.
Comments.UserDisplayName: Aiden
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-28T13:00:52.070Z
Comments.Text: Oh, I see, my mistake : "Note that any event prices you have configured in CiviCRM are not imported into the Webform - you will need to reconfigure them here."
Comments.UserDisplayName: samuelsov
Tags: <civicontribute><webform-civicrm><line-items>
Title: Trouble with editing contributions with multiple line items
ThreadText: # Trouble with editing contributions with multiple line items
  
  (Asked by: username_0 on 2023-09-23)
  
  In a Drupal 7 site we are using webform\_civicrm for paid event registrations. The webform creates the contribution with the participant fee (civicrm\_participant line item) as well as other additional (civicrm\_contribution) line items. All is well until one goes to the edit form of the contribution and saves, this recalculates the total amount and tax amount and only includes the first line item (participant fee). Occasionally other line items have been manually added to the contribution with the line item edit extension and those are also civicrm\_participant line items, but also ignored.
  
  I did some digging in the civi core code. In the contribution edit submit function it looks as if only civicrm\_participant line items are fetched if the contribution is recognised as a participant contribution. And while all the participant line items are added to the $params array, if the price set is quick config it seems deliberate that only the first one is used for the total amount and tax amount. All of our webform\_civicrm generated line items fall under the reserved quick config price set 1.
  
  I ended up using some code to check and correct total\_amount, tax\_amount and net\_amount in a hook\_civicrm\_pre implementation, but I would love it if someone could shed some light on where the fault lies here.
  
  **Tags:** civicontribute, webform-civicrm, line-items
  
  > **Comments:**
  > **username_1**: Can you clarify ? How do you define the contribution line items in webform ? How is your event price set up ?  
  > **username_0**: I'm not sure what you're asking, webform_civicrm provides the line item and participant fee fields after enabling them, the values (prices) are assigned through conditionals in this case. The webform_civicrm code uses the default quick config price set for the line items. I'd imagine any participant contribution which is_quick_config and has multiple line items would have this issue regardless of any other factors.  
  > **username_1**: Quick config depend on how you define the prices on your event. If you haven't done a priceset, it will be quickconfig but you can change that and webform should use whatever you have on your event.  
  > **username_0**: Looking at the code I don't think that's true, it uses 'default_contribution_amount' unless there's a membership id in which case it uses 'default_membership_type_amount'. I checked it out and found we do have the event set up with a price set which is not quick config.  
  > **username_1**: Oh, I see, my mistake : "Note that any event prices you have configured in CiviCRM are not imported into the Webform - you will need to reconfigure them here."  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-11-03. Score: 1 | Accepted answer
  
  The short answer to my question (after discussion with CiviCRM and webform\_civicrm devs) is that quick config price sets were designed for single line item contributions, webform\_civicrm uses quick config for all contributions as there's no better alternative. So currently there is an unresolved compatibility issue with tentative plans to change Civi core to be more flexible. The triaged issue on the core repo is [here](https://lab.civicrm.org/dev/core/-/issues/4698).
  
  
  ---
  
  