Payment info pane ajax refresh doesn't fully support adjustments that result in zero cost orders

Created on 27 April 2022, almost 3 years ago
Updated 5 February 2025, 3 months ago

#2856583: Allow free orders (checkout without payment) allows users to check out with zero cost orders and properly hides the payment method add form in the payment info pane during checkout, but only if the order total is already zero when the user first loads the checkout step page with that pane.

However, when the order total is adjusted to zero via a promotion and the form is reloaded via ajax, the payment method add form remains until the page is fully reloaded.

And if the page has been reloaded and the payment method form is not displayed, it will not reappear if the promotion is removed and the form reloaded via ajax.

Steps to reproduce:

- Have a promotion that can reduce the order cost by 100%.
- Have a payment gateway that implements SupportsCreatingPaymentMethodsInterface.
- Include the Payment Information pane (Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation) in the checkout flow.
- Include the Coupon redemption pane in the same step of the same checkout flow.
- During checkout, apply the 100% promotion.

Expected result:

The payment method form should not appear after the promotion form is submitted via ajax and the order total is reduced to $0.

Actual result:

The payment method form still appears even though the order total displays as $0. A full page refresh results does remove the payment method form.

Further steps:

- Fully reload the checkout page with the payment info and coupon redemption.
- Remove the 100% promotion.

Expected result:

The payment method form should appear after the promotion is removed via ajax.

Actual result:

The payment method form does not appear until the page is fully reloaded.

🐛 Bug report
Status

Active

Version

3.0

Component

Payment

Created by

🇺🇸United States jeffam

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States jeffam

    Ours is clearly a rare case, but we still have this issue after an upgrade to 3.x.

    I'll attach the patch that fixes it for us, but it still doesn't feel like the right long-term solution.

  • 🇮🇳India sorabh.v6 Indore

    Somehow, I was not able to reproduce the issue even when tried multiple times. Please look at the uploaded video.

    @jeffam please confirm if I am following the right approach to reproduce the issue. If yes, then I think this issue is resolved as part of some other issue and we can close this issue.

    Thanks

  • Status changed to Closed: cannot reproduce 3 days ago
  • 🇮🇱Israel jsacksick

    Considering there was no response for over 2 months, closing this.

Production build 0.71.5 2024