0

I have looked for the solution for weeks, but I have not found any. It must be very trivial that I missed.

I'm adding a line item field in addition of the default unit price and quantity called "length" in the cart view and Order. I would like to get the new calculated line item total = price * quantity * length.

Solutions that I have found so far change the line item unit price, which is not desirable.

How can I do this?

1 Answer 1

1

The line-item unit price is used throughout commerce and the total order amount is based on the line-item total value (quantity * unit price). There is no way to circumvent this behavior.

Better would be to add another price field to the line-item Price per length-unit. Hide the default price field and calculate the sales price as you've found in other answers.

Basically this is a pricing rule in Store > Configuration > product pricing rules where you add the event Set the unit price to a specific amount to a calculated value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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