Issue #3494179: Checkout with payment method without billing address not working

Closes #3494179

PaymentInformation::submitPaneForm() copies a stored payment method's billing profile onto the order without checking it exists. A gateway that does not collect billing information (e.g. Stripe Payment Element with collect_billing_information: false) stores its payment methods without one, so reusing such a payment method throws:

TypeError: Drupal\commerce_order\Entity\Order::setBillingProfile(): Argument #1 ($profile) must be of type Drupal\profile\Entity\ProfileInterface, null given

The fix is the NULL check suggested in the issue, matching the sibling branch for on-site gateways.

StoredPaymentMethodWithoutBillingTest checks out with a profile-less stored payment method of example_stored_offsite_redirect: it fails without the fix and passes with it.

Merge request reports

Loading
Loading