Skip to content

Remove stale #selectedPaymentOption input from paymentOptions.isml #1498

Description

@rge-dS

Is your feature request related to a problem? Please describe.
In paymentOptions.isml, there is a hardcoded hidden input field:

<input type="hidden" class="form-control" id="selectedPaymentOption"
       name="${pdict.forms.billingForm.paymentMethod.htmlName}"
       value="paymentMethod"/>

The static value "paymentMethod" does not correspond to any valid Business Manager payment method ID (the valid IDs are AdyenComponent, AdyenPOS, CREDIT_CARD). In older versions of the cartridge (≤ 25.x), this was acceptable because checkout.js immediately overwrote the value on page load and on tab change

$('#selectedPaymentOption').val($('.payment-options .nav-item .active').parent().attr('data-method-id'));
$('.payment-options .nav-link').click(function () {
  $('#selectedPaymentOption').val($(this).parent().attr('data-method-id'));
});

This JS was removed in v26, but the stale input field was never cleaned up. The field now sits in the DOM with a hardcoded value that is never updated, causing integrators who use native FormData for the billingform submission (instead of jQuery's serializeArray().reduce()) in checkout/index.submitPayment() to always receive "paymentMethod" on the server — breaking payment method resolution.

Describe the solution you'd like
Remove the #selectedPaymentOption input from paymentOptions.isml entirely. The correct payment method value is already reliably provided by the hidden input in adyenComponentContent.isml (value="AdyenComponent") and its counterparts for other payment method tabs. The #selectedPaymentOption field serves no purpose in the current codebase since nothing reads or writes it.

Describe alternatives you've considered

  • Restoring the JS lines that updated #selectedPaymentOption dynamically — functional, but adds code to maintain for a field that has no other purpose.
  • Integrators can work around this by explicitly calling FormData.set('dwfrm_billing_paymentMethod', activeTabMethodId) before submission; but this should not be required.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementEnhances an existing feature

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions