Drupal Association members fund grants that make connections all over the world.
Well, this was a challenge to explain succinctly in the title.
I have a few payment method rules (i.e., rules reacting to the event "Select available payment methods for an order"). I've added conditions to these rules that they should only react if the order total is greater than 0. However, this is problematic in the following scenario:
- User begins checkout process with a $100 item in the cart.
- User chooses appropriate payment method, then proceeds to the /checkout/%/payment page to enter payment details.
- User realizes she forgot to enter the coupon code for her $100 coupon, and goes back to the first checkout page to enter it. (In my checkout setup, this is allowed.)
- She enters her coupon code, bringing her order total to $0.00.
- She then proceeds to the /checkout/%/review page, where there are no longer any payment methods listed. (This is to be expected, given the Rules configuration I mentioned.)
- She clicks "Continue to next step" at the bottom, only to be taken to the /checkout/%/payment page to enter payment details, as in #2 above.
The reason for this is that, after the user chose a payment method in step 2, that payment method was attached to the order via the $order->data property. Once she returned to the first checkout page and entered her coupon (so that her order total was now $0.00), the payment methods were hidden from her, but the payment method she'd chosen earlier was still attached. Thus, when continuing from the Review page, she was still prompted for payment details.
I'm not sure that this is a bug, or a task, or what. It seems like a bug, but perhaps I need to simply handle it differently. (For example, I could remove the "greater than 0" condition from the payment method rules, install the "Free payment method" module, and have it be selected by default if the order total is 0...? I'm not sure that selecting a method by default is possible with Rules, but I'll look into it...)
Anyway, thoughts on how to solve this?