Answers.Body: <p>You would need to change the price of the line item based on the option data sent in.</p>
  <p><a href="https://craftcms.com/knowledge-base/dynamically-customizing-line-item-prices" rel="nofollow noreferrer">https://craftcms.com/knowledge-base/dynamically-customizing-line-item-prices</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-16T10:36:49.670Z
Answers.Text: The worst thing is that you cannot change the total and subtotal, as this is a property read, except adjusters.
Answers.UserDisplayName: RomanAvr
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-22T12:37:39.167Z
Answers.Text: Thanks @Luke for your answer. You pointed me at the right place. However, from what I see, it looks like all the previous line-items are visited in the process. Althought the rules don't change, it will perform calc on already saved items. 
  Is there a way to get a hook on the actual item added to the cart ?
Answers.UserDisplayName: Sylvain Tremblay
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-15T12:36:12.867Z
Answers.LastActivityDate: 2022-06-15T12:36:12.867Z
Answers.UserDisplayName: Luke Holder
Body: <p>On the &quot;add to cart&quot; page, I let the user enter &quot;Width&quot; &amp; &quot;Length&quot; to calculate the number of Square Foot as the quantity which works fine with a JS function. Now my client wants to add an &quot;overhead&quot; price to the product based on the selected variations. Is there a way, either an &quot;hidden field&quot; in the form OR a hook in the module where I can put the amount to add to the line item ?
  Or any other best idea is appreciated as well !
  I'm on Craft Commerce 4.</p>
  
Tags: <plugin-craftcommerce><plugin-craftcommerce4>
Title: Add amount to cart line item
ThreadText: # Add amount to cart line item
  
  (Asked by: username_0 on 2022-06-15)
  
  On the "add to cart" page, I let the user enter "Width" & "Length" to calculate the number of Square Foot as the quantity which works fine with a JS function. Now my client wants to add an "overhead" price to the product based on the selected variations. Is there a way, either an "hidden field" in the form OR a hook in the module where I can put the amount to add to the line item ?
  Or any other best idea is appreciated as well !
  I'm on Craft Commerce 4.
  
  **Tags:** plugin-craftcommerce, plugin-craftcommerce4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-15. Score: 1 | Accepted answer
  
  You would need to change the price of the line item based on the option data sent in.
  
  <https://craftcms.com/knowledge-base/dynamically-customizing-line-item-prices>
  
  > **Comments:**
  > **username_2**: The worst thing is that you cannot change the total and subtotal, as this is a property read, except adjusters.  
  > **username_0**: Thanks @username_1 for your answer. You pointed me at the right place. However, from what I see, it looks like all the previous line-items are visited in the process. Althought the rules don't change, it will perform calc on already saved items.  Is there a way to get a hook on the actual item added to the cart ?  
  
  ---
  
  