• Resolved bmooij

    (@bmooij)


    Hello everyone,

    I have a problem with my Woocommerce webshop. On the checkout page I only have 1 payment method enabled (Mollie iDEAL). When a new user is on the checkout page, it needs to fill in all their information. Because there is only one payment method, the user doesn’t need to select the payment method, because it is already selected. But when the user wants to proceed, it gets the following error message: ‘no payment method selected’ (in Dutch: geen betaalmethode geselecteerd).

    When the user refreshes the page, their information is already filled in. And now they can proceed with the payment.

    I dug a little bit into the code, and I noticed that in the DOM the iDEAL option is checked, but in the POST request I don’t see the payment_method.
    I made a (very) dirty work-a-round for my issue. I will post that at the bottom.

    My environment:

    • WordPress (Version 6.8.3)
    • Mollie Payments for WooCommerce (Version 8.0.6)
    • WooCommerce (Version 10.3.3)

    My work-a-round
    My work-a-round to make this work, is to add a custom HTML block to the checkout page and add the following javascript to the page. This sets first the current payment to the (not enabled) “Direct bank transfer” and then reset it back to the mollie iDEAL payment method.

    Technical: I think the issue is in the paymentMethodId, because the activePaymentMethod is set correctly (tested with wp.data.select('wc/store/payment').getActivePaymentMethod()). But the value of paymentMethodId is not updated. https://github.com/woocommerce/woocommerce/blob/4d2bb38575840530b70ef339ceb4997a6494db43/plugins/woocommerce/client/blocks/assets/js/base/context/providers/cart-checkout/checkout-processor.ts#L125

    <script type="text/javascript">
    jQuery(function($) {

    function setPaymentMethod(method) {
    return new Promise((resolve) => {
    const unsubscribe = wp.data.subscribe(() => {
    const current = wp.data.select('wc/store/payment').getActivePaymentMethod();
    if (current === method) {
    unsubscribe();
    resolve();
    }
    });
    wp.data.dispatch('wc/store/payment').__internalSetActivePaymentMethod(method);
    });
    }

    (async () => {
    await setPaymentMethod('bacs');
    await setPaymentMethod('mollie_wc_gateway_ideal'); // final state
    console.log("Mollie FIX");
    })();

    });
    </script>

    Today I tested it with the latest version 8.1.0 of the plugin, now I get a 400 bad request.
    :8080/index.php?rest_route=/wc/store/v1/checkout&_locale=site:1 Failed to load resource: the server responded with a status of 400 (Bad Request)

    The error message is now Something went wrong. Please contact us to get assistance.

    The refresh method when a user already has filled in their “Billing address” doesn’t work any more.

    Btw, the work-a-round still works

    • This topic was modified 6 months, 2 weeks ago by bmooij.
    • This topic was modified 6 months, 2 weeks ago by bmooij.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Femi

    (@femiyb)

    Hello @bmooij

    I tested for this issue, but could not reproduce this as you have reported, with both version 8.0.6 and 8.1.0.

    Could you please confirm ithe steps to reproduce this issue?

    Could you confirm if this issue occurs every time you test for it?

    Regards,
    Femi.

    Thread Starter bmooij

    (@bmooij)

    Yes I can reproduce it every time.

    I it only when a user needs to fill in their information. When they do a refresh after getting the error, the user information is already filled in and then it works.

    The only “odd” thing is that my webshop only has only one “local pickup” as delivery method. (So no other delivery methods). Maybe that helps to reproduce it.

    Plugin Support Femi

    (@femiyb)

    Hello @bmooij, thanks for confirming that

    Today I tested it with the latest version 8.1.0 of the plugin, now I get a 400 bad request.
    :8080/index.php?rest_route=/wc/store/v1/checkout&_locale=site:1 Failed to load resource: the server responded with a status of 400 (Bad Request)

    The error message is now Something went wrong. Please contact us to get assistance.

    If I understand correctly, based on what you mentioned here, the initial error from 8.0.6 is gone when you update to 8.1.0, but with 8.1.0, you now see a different error?

    As I know 8.1.0 should fix the initial error you mentioned

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘No payment method provided’ is closed to new replies.