• Resolved copyart

    (@copyart)


    I want to make a sticker calculator.
    Is it possible to calculate the price based on the quantity, e.g.
    1 sticker costs 10.00
    10 stickers cost 8.00 per sticker
    20 costs PLN 6.00 per sticker
    The price per sticker is lower for larger quantities

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello, @copyart

    This case can be solved using a JS formula, namely an if/else condition. I assembled a calculator according to your description and demonstrated the calculator in the video:

    Link

    Formula used in the calculator:

    if ( quantity_field_id_0 < 10 ) { quantity_field_id_0 * 10 } else if ( quantity_field_id_0 >= 10 && quantity_field_id_0 <20 ) { quantity_field_id_0 * 8 } else if ( quantity_field_id_0 >= 20 ) { quantity_field_id_0 * 6 }

    You can continue the formula and lower the price relative to the quantity.

    Best regards.

    Thread Starter copyart

    (@copyart)

    hello
    Thanks for the answer, the formula works. What formula to add to make the amount greater than or equal to 30 to the condition formula.
    Best regards.

    Hello, @copyart

    I didn’t quite understand what kind of condition you need to add and whether it is related to your last request. Could you please, as in the first example, describe the principle of the calculator?

    Best regards.

    Thread Starter copyart

    (@copyart)

    This is related to a recent request. I need a formula with a minimum price. The calculator displays a fixed price, e.g. 30 above this amount, it calculates according to the formula you wrote me.
    I need to combine these formulas
    if ( (total_field_id_8total_field_id_9) >30) { (total_field_id_8 total_field_id_9) } else {30}
    with this formula if
    ((total_field_id_8) < 10) { (total_field_id_8) * (total_field_id_9) } else if ((total_field_id_8) >=10 && (total_field_id_8) < 30) { (total_field_id_8) ((total_field_id_9)0.75) } else if ((total_field_id_8) >=30 && (total_field_id_8) < 50) { (total_field_id_8) ((total_field_id_9)0.65) } else if ((total_field_id_8) >=50 && (total_field_id_8) < 70) { (total_field_id_8) ((total_field_id_9)0.55) } else if ((total_field_id_8) >=70 && (total_field_id_8) < 10000) { (total_field_id_8) ( (total_field_id_9)0.50) }

    Plugin Support EricStylemixThemes

    (@ericstylemixthemes)

    Hello @copyart

    Sorry for keeping you waiting.

    I checked your formula and there some mistakes and some symbols missing. it seems WordPress editor misformatted.

    if you need to combine our agent’s formula with yours, you can just continue adding else if and the last statement should be finished with else:

    https://www.w3schools.com/js/js_if_else.asp

    If you can attach an exported version of your calculator, we can review the logic that you are using.

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conditional calculations based on quantity’ is closed to new replies.