• Resolved brendmedia

    (@brendmedia)


    Good afternoon.
    How to solve the problem using a discount, which depends on the circulation. The circulation of 1 piece costs 1.4 rubles. and with a circulation of 100 pieces, the cost should decrease (let’s say by 10%)

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @brendmedia !

    Hope you’re having a good day!

    The formula in the calculations will be the following one:

    {number-1} * 1.4 - min(max(floor(((({number-1} - 0) * (1 - 0)) / (100 - 0)) + 0)), 0), 1) * {number-1} * (1.4 * 0.1)

    Where:
    – {number-1} is the field with the amount (circulation)
    – 1.4 is the price
    – 100 is the threshold for when to start applying the discount
    – 0.1 is the discount to be applied after the circulation reaches 100 or more

    What it does, it calculates the normal price as usual, but the also does a trick to subtract 0 or the discount based on the amount. It’s basically a function to change the amount into a smaller range and then it’s clamped to 0 or 1, so it’s basically this:

    {number-1} * price - if_more_than_100(discount)

    Kind regards,
    Pawel

    Thread Starter brendmedia

    (@brendmedia)

    Thanks for the help.
    And now you can indicate that with a circulation of <= 100, a 10% discount.
    With a circulation <= 200, a 15% discount and so on until the circulation I need?

    • This reply was modified 3 years, 5 months ago by brendmedia.
    Plugin Support Imran – WPMU DEV Support

    (@wpmudev-support9)

    Hello @brendmedia !

    Hope you’re doing well today!

    Sure, though there is one question with that – whether you want the discount to be applied to all items when a certain limit is reached, if so, then the calculations will look like this:

    {number-1} * 1.4 
    - {number-1} * (1.4 * 0.1)
    - min(max(floor(((({number-1} - 101) * (1 - 0)) / (200 - 101)) + 0)), 0), 1) * {number-1} * (1.4 * 0.05)
    - min(max(floor(((({number-1} - 201) * (1 - 0)) / (300 - 201)) + 0)), 0), 1) * {number-1} * (1.4 * 0.05)
    - min(max(floor(((({number-1} - 301) * (1 - 0)) / (400 - 301)) + 0)), 0), 1) * {number-1} * (1.4 * 0.05)

    This will translate to:
    – if number <= 100 – 10% discount on all
    – if number <= 200 – 15% discount on all
    – if number <= 300 – 20% discount on all

    As you can see, you can add more of those at the end there until you reach your target value:

    - min(max(floor(((({number-1} - 301) * (1 - 0)) / (400 - 301)) + 0)), 0), 1) * {number-1} * (1.4 * 0.05)

    Where:
    – 301 – lower range
    – 400 – upper range
    – 1.4 – price
    – 0.05 – the additional applicable discount

    But if you want it to be like this:

    – if number <= 100 – 10% discount on all
    – if number <= 200 – 10% discount on first 100, then 5% on the ones above 100
    – if number <= 300 – 10% discount on first 100, then 5% on the ones above 100 and 3% on the ones above 200

    Then the calculation will look like this:

    {number-1} * 1.4 
    - {number-1} * (1.4 * 0.1)
    - min(max(floor(((({number-1} - 101) * (1 - 0)) / (200 - 101)) + 0)), 0), 1) * ({number-1} - 100) * (1.4 * 0.05)
    - min(max(floor(((({number-1} - 201) * (1 - 0)) / (300 - 201)) + 0)), 0), 1) * ({number-1} - 200) * (1.4 * 0.03)

    Kind regards,
    Pawel

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @brendmedia ,

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

    Please feel free to re-open this ticket if needed.

    Kind regards,
    Kasia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Forminator CALCULATIONS’ is closed to new replies.