• Resolved mlchrt

    (@mlchrt)


    Hi there,
    I wanted to ask if it’s possible to somehow apply graduated prices depending on the user input? So for example if the user enters 100pcs of a product I would calculate the single price for an item times 100. But if there’s a different single price for 101-200 pieces how can I calculate depending on quantity. I need somehow an if()-Option in the calculation fields?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mlchrt

    I hope you’re well today!

    There’s no “if/else” conditional calculations (at least not yet) but depending on the “pricing structure” it might be possible to achieve something like that with either calculation formula alone or some additional (conditionally visible) field or a combination of both.

    Here you’ll find example form that you can import to your site and review its settings:

    https://pastebin.com/PdZxPcXn

    It lets you input number of pieces then shows a “per piece price” below and calculates total price, following the rule that:

    – up to 100 pieces the price is 10 per piece
    – between 101 and 250 pieces, price is 8 per piece
    – and over 250 pieces, price is 6 per piece

    The way it works is it uses additional calculations-type fields to determine the price (note the number * 1 trick there in calculation formula, like 10*1 to set price at 10).

    These fields have visibility set depending on the input (number of pieces) and then for the total price the number of pieces is multiplied by the sum of all these prices. This works because for invisible calculation fields the value is just 0.

    So for example, if you set 10 pieces, the first price calculation field will be visible setting the price at 10*1 = 10 and the final calculation becomes

    10 pieces * ( 10 price + 0 price + 0 price) = 10 pieces * 10 price = 100 price to pay

    For 108 pieces it becomes

    106 pieces * ( 0 price + 8 price + 0 price) = 106 pieces * 8 price = 848 price to pay

    For 253 pieces it becomes

    253 pieces * (0 price + 0 price + 6 price) = 253 pieces * 6 price = 1518 price to pay

    Best regards,
    Adam

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mlchrt ,

    We haven’t heard from you for several days now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

    Thread Starter mlchrt

    (@mlchrt)

    Hi Kasia & Adam,
    thanks for your reply. Just one short question about the form you pasted there. When I change the decimal seperator to another format (e.g. 1.254,12) it wont calculate the total field.

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mlchrt

    I just checked and I can confirm that but I’m afraid there’s no simple workaround for it currently (other than using the “default” format that I used in the form).

    There are some known issues related to calculations along with visibility conditions. In most cases it’s fine but some “unusual” cases like this here can be affected. Our developers are working on improvements so I believe with future releases it should be fine but I don’t have an ETA, I’m afraid.

    Kind regards,
    Adam

    Thread Starter mlchrt

    (@mlchrt)

    Hi Adam,
    thanks for your reply. Is there possibility to change the display type with some workarounds like putting another calculator field inbetween? Or how is it somehow possible to display larger prices with some seperator at all.

    Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @mlchrt !

    Hope you’re doing well today!

    You can use another Calculations field in this case and set the formula to take the value from the original field, then apply settings for formatting:

    View post on imgur.com

    In this case the first field has some formula to do the calculations (you can hide it) and then the second field just takes the result and applies the formatting and separators.

    Warm regards,
    Pawel

    Thread Starter mlchrt

    (@mlchrt)

    Hi Pawel,
    do have an example showing a translation of an result to a new format? As shown in the image? How can I take an result and set the right format?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @mlchrt

    I hope you are doing well.

    The Pawel is about using two fields.

    You would use two calculation fields

    {calculation-1} to calculate using the format that works and your formula, it can be hidden.

    {calculation-2} the formula is just {calculation-1} then you can show it in the correct format on the front end.

    An exported form:
    https://pastebin.com/GnMEqU9w

    Best Regards
    Patrick Freitas

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Graduated pricing in calculated fields’ is closed to new replies.