Mario
Forum Replies Created
-
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.
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“.
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 yearThanks for any support
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 feeThis 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.
I had the same issue and I believe it can be related to the way PayPal communicates back to PMPro after checkout.
Since the documentation of PMPro says PayPal Express is recommended instead of PayPal Standard, I tried to set-up PayPal Express as the payment gateway.
Then, everything was fine. Now just one invoice is issued, as expected.
Of course the problem is still there if you use PayPal Standard but PayPal Express should be just better.
Unfortunately, when a discount code is applied, a similar bug happens and I get again two orders/invoices issued, the second of which has zero amount. But, this time, I believe the problem is related to the way discount codes are managed.
I opened a dedicated topic for that “Additional order with zero amount when discount code is applied”.