• Resolved Mario

    (@mario71)


    I’ve set-up paid-membership-pro together with the following add-ons:
    – pmpro-roles
    – pmpro-affiliates
    – pmpro-register-helper

    I’ve noticed that, when a discount code is applied, the system issues two orders: one with the correct amount (invoice), the other one with zero amount.

    If the discount code is not given, just one order/invoice with the correct amount is issued, as expected.

    https://ww.wp.xz.cn/plugins/paid-memberships-pro/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Mario

    (@mario71)

    I believe the bug can be related to the way discount codes are managed, in particular, I have the feeling that such a calculation may be performed by the system:
    – 1st invoice amount: initial subscription fee – initial discounted fee
    – 2nd invoice amount: recurring subscription fee – recurring discounted fee

    This way, if the discount code just reduces the initial subscription fee, while keeping the same recurring fee, the 2nd invoice would have zero amount but the system should filter it disabling order/invoice recording, which is not currently done.
    Even better the second calculation should not even be executed when the “recurring” checkbox is not flagged in the discount code settings.

    Correction of this behaviour is critical for clean book-keeping.

    Hey there,

    Unfortunately I can’t recreate this on my dev setup.
    What payment gateway are you using? What are the exact details of the membership level you are checking out for and the exact details of the discount code?

    That might help figure out why this is occuring.

    If you want, we can also take a look at your site if you become a PMPro member and post on the member forums.

    Thanks,
    Jess

    Thread Starter Mario

    (@mario71)

    The payment gateway I use is Paypal Express.
    About the membership level and discount settings, the details are very basic, as shown below:
    – membership level:
    – just initial payment (no recurring fees)
    – no trial period
    – expiration after 1 year
    – discount code:
    – just discounted initial payment (no recurring fees)
    – no trial period
    – expiration after 1 year

    Thanks for any support

    I’m still only receiving 1 invoice with those details on my setup. Do you have any addons/custom code installed on your site? This may be a plugin/theme conflict, so also try deactivating your plugins one by one and/or switching to a default WordPress theme such as twentyfourteen and see if you can isolate the issue.

    Thread Starter Mario

    (@mario71)

    I deactivated all the custom code pieces one by one but, unfortunately, nothing changed.
    I would like to highlight that:
    – if no discount code is given, everything works fine and just one invoice is issued
    – if discount code is specified, the first and “real” invoice (everything correct inside this one) is issued right after PayPal Express checkout, while the second order having zero amount is created (I checked in the database) just after the last confirmation step (after PayPal redirects back through my portal)
    – the “spurious” order has “Payment Gateway” = ‘check’, while for “regular” free subscriptions I get “Payment Gateway” = ‘free’

    After looking into the plugin code, I believe this behavior might depend on some action taken during “review“, inside “preheaders/checkout.php“.

    Thread Starter Mario

    (@mario71)

    Ok, at the end I solved it.

    It looks like is a default behavior defined in the “pmpro-affiliates” add-on, as described in the related documentation (readme.txt):

    = .2.2 =
    * Will add a $0 invoice if someone checks out for a free level with an affiliate code set.

    The solution consisted in adding the following to functions.php in the child theme folder:

    remove_action("pmpro_after_checkout", "pmpro_affiliates_no_order_checkout");

    Thank you for you support.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Additional order with zero amount when discount code is applied’ is closed to new replies.