Problem/Motivation
Currently, the Amazon payment method does not take into consideration discounts or coupons that might have been added after the user has begun the Checkout process. For example,
Prerequisites:
- Billing address pane on Checkout page
- Payment pane on Review page
- Do not require payments at checkout, and show a message
- Create a new Gift Card that covers your order total.
- Choose Amazon Pay at the cart page
- Apply the coupon at Checkout
- Proceed to the Payment/Review page
In this example, the Amazon Billing Page will appear. This is because the Amazon Pay method puts a payment method callback into a hook_form_alter() implementation. The result is that, even if Rules are configured to not show the Amazon Pay method if an order is not free, the message "Payment is not required for your order" appears as well as the wallet widget.
I should note that this used to work better, but I believe some recent changes to how discounts are calculated has surfaced this issue (possibly a regression). However it still seems weird that the LPA module would still return a form despite Rules evaluating to FALSE.
Proposed resolution
Verify that the order total is greater than zero before returning a pane form.
User interface changes
None
API changes
Minor condition added
Comment | File | Size | Author |
---|---|---|---|
#2 | 2933997-commerce_lpa-free_orders.patch | 1 KB | torgosPizza |
Comments
Comment #2
torgosPizzaUpdating the title a bit, and here's a patch.
Comment #3
mglamanShould we run this first,
commerce_order_calculate_total
? Or I suppose it is already calculated when entering checkout.Comment #4
AnybodyDoes someone know if a similar logic is already implemented in other modules like commerce_paypal where we could have a look for #3?
I'm also unsure.
Another concept could be to detach commerce_amazon_lpa with a rule if total is zero? I guess that should already work?