Discussions

Field line_item in cart summary.

Hi everybody!

I have a custom field created in line item. The question is: How can I calculate the sum of this field? Using rules, of course. And the result of this sum put it in the summary cart. Thank for your help!

Yatiri.

Posted: Feb 10, 2012

Comments

ccoppen on February 10, 2012

Event --> Pricing rule...

Condition -->
Entity has field -> commerce-line-item
Select the name of your line item...

Action

Data calculate a value
commerce-line-item:[whatever your line-item name is]
More than likely multiply by 100 to get proper amount, provided your custom line item is an integer.

Type a meaningful name to use in the next step.

Add another action:
Set unit price to specified amount.
Parameter: Line item: [commerce_line_item], Amount: [Whatever variable you set in previous step]

I hope this helps. I got this from Randy Fay with my modifications.