• Resolved Jan

(@jannetto96)

we would like to create a cost calculation form for the courier in this way:

practically the first kilogram of the product costs him € 22 while the kilograms later cost € 8 each.

So assuming I have 10 kilograms of stuff to deliver it would cost me € 22 + 8 * 9 (as the first kilogram costs € 22)

how can I create my calculation form to be created for my customers as they can understand how much shipping costs based on kilograms? Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
• Plugin Author codepeople

(@codepeople)

Hello @jannetto96

The process can be implemented as follows:

Assuming the field for the weight is the fieldname1, insert a calculated field with the equation:

``````
IF(fieldname1, 22+MAX(fieldname1-1,0)*8, '')
``````

and that’s all.
Best regards.

(@jannetto96)

Really Thank you for your help!

(@jannetto96)

the last question … if instead it should be done € 3 for each 12 kg? what do you suggest to me? thanks for your patience…

Plugin Author codepeople

(@codepeople)

Hello @jannetto96

If it is 3€ for each 12kg, as a whole:

``````
CEIL(fieldname1/12)*3
``````

But if you want to apply 22€ for the first kg and 3€ for each remaining 12kg:

``````
IF(fieldname1, 22+MAX(CEIL((fieldname1-1)/12),0)*3, '')
``````

Best regards.

(@jannetto96)

It works Thankyou! But how to insert decimal? I mean it’s not 3 but 3,90

Plugin Author codepeople

(@codepeople)

Hello @jannetto96

In this case, don’t use the CEIL operation:

``````
(fieldname1/12)*3
``````

or

``````
IF(fieldname1, 22+MAX((fieldname1-1)/12,0)*3, '')
``````

Best regards.

(@jannetto96)

Hello, @codepeople ,
I tried this but if I insert `(fieldname1/12)*3,9` it gives me 90 by default without entering any value, as you can see in this screenshot:

https://i.imgur.com/pX2ayJs.png What does mean?

Plugin Author codepeople

(@codepeople)

Hello @jannetto96

The decimal separator symbol in javascript is the point (.) and not the comma (,), furthermore, if you want the equation be evaluated only after the user enter a value into the fieldname1 field, I recommend you to use a conditional operation as part of the equation, as follows:

``````
IF(fieldname1, (fieldname1/12)*3.9, '')
``````

and that’s all.
Best regards.

Viewing 8 replies - 1 through 8 (of 8 total)
• The topic ‘Help with kg’ is closed to new replies.