If you change the country for the billing address, or click the Recalculate shipping button, the Stripe elements disappear because the module JS detaches the behavior.

Braintree fixed this issue in #2890465: Changing the address country (and other #ajax) clears the braintree form by checking the detach trigger, but the same fix didn't work for me here.
Looks like we need to follow what the D7 code did, basically remove the detach method completely, and make the attached behavior skip tokenization if the underlying form is no longer present (cause an existing payment method was selected, etc).

CommentFileSizeAuthor
#2 js_detach_issue-2893928-2.patch905 bytesvasike

Comments

bojanz created an issue. See original summary.

vasike’s picture

Status: Active » Needs review
StatusFileSize
new905 bytes

i was able to get it working with detach

i only add some extra "checks for existence the elements" we want to deal with.

@bojanz: what do you think about this patch?

  • bojanz committed d6aeea9 on 8.x-1.x authored by vasike
    Issue #2893928 by vasike: Recalculating shipping or changing the country...
bojanz’s picture

Status: Needs review » Fixed

That did the trick, thank you!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.