• Resolved thekayakgirls

    (@thekayakgirls)


    I’m trying to create a form where the default price can be discounted with the user entering a code. I have two discount codes which result in either a 20 or 30% discount off the default price.
    Do I use the calculation fields to calculate a cost based on which/if a code is entered? I only see room for one calculation no matter how many rules I add.
    Do I do a calculation field for each code (or lack of code)? If so, how do I tell Paypal which field is the final cost?

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

    (@wpmudev-support8)

    Hello @thekayakgirls

    I hope you’re well today!

    Currently it’s not that simple “out of the box” I’m afraid. A foundation would be to use “Calculations” field as a source for the payment amount for PayPal field.

    Then you would need to actually calculate the discount based on the coupon code and that get’s a bit more tricky. One way would be to add two “number” type fields (as they can be used in calculations) and use conditional logic to show them depending on the “coupon” input field value. Then in “Calculations” field you would set a calculation like e.g.

    100 - {number-1] - {number-2}

    where 100 is your full price, number-1 would be replaced with the value of first number field (which should contain amount of discount for 20% discount) and number-2 would be replaced with the value of second number field (which should contain amount of discount for 30% discount).

    This would work correctly calculation the price but the problem is that those field wouldn’t be “read only” so customer could actually freely edit them. Therefore that would require some additional customization – via custom code – to make them “read only”.

    Another way would be to use three separate calculations field instead. One should show only if coupon field value is equal to 20% coupon (that can be done via “Visibility” settings – conditional logic) and the second one only if coupon field value contains 30% coupon.

    Then the 3rd calculations field would include a calculation such as e.g. “full price – 1st calculation – 2nd calculation” and would be used as source for payment.

    Best regards,
    Adam

    Thread Starter thekayakgirls

    (@thekayakgirls)

    If I’m understanding you correctly, this 3rd calculation field should show the final cost (either with the discount generated in either of the calculation fields, or the full cost if no code is entered) and that’s what I would link Paypal to. The 1st two fields are working great. Only 1 shows up when I test a certain coupon code. But when I add the 3rd calculation field and type full price – calculation 1 – calculation 2 in the calculation tab, it subtracts both discounts.

    I assume the – in your text is a minus sign but maybe that’s where I’m going wrong?

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hello @thekayakgirls

    Thank you for response!

    You’re right! There was a bug in the plugin related to calculations based on conditionally displayed fields and I believed it was fully fixed in the recent release but apparently it wasn’t.

    I should have check that better, I’m sincerely sorry!

    I’ve reported it again to our developers so they could fix it so please keep the plugin up to date as I’m afraid there’s no workaround meanwhile. We’ll update you here, though, if we’ll find another way before the issue is fixed.

    Once again, I apologize for misinformation!

    Kind regards,
    Adam

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Discount codes with PayPal?’ is closed to new replies.