Hide "Wallet" payment option when there is no money in the wallet

Created on 20 May 2024, 6 months ago
Updated 22 May 2024, 6 months ago

Problem/Motivation

I installed Commerce Funds module. I intended to use this module to allow my customer to pay with credit. It works well when the customer has credit. I have restricted the Funds Balance payment method only available to authenticated user. However for any authenticated user, the "Wallet (USD)" payment option is always the default option even when the given customer has no credit in his wallet. Is there any configuration or ways to make the Wallet option not show when the customer has no credit or at least not make it a default option?

Steps to reproduce

Log into the website, add a product to the cart, go to check out. Wallet(USD) will be the default payment option.

Proposed resolution

When the customer has no money in their wallet, hide "Wallet" and "Funds Balance" options. At least, make them not the default options.

πŸ› Bug report
Status

Active

Version

2.1

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States iseeaflyingcrane

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

Comments & Activities

  • Issue created by @iseeaflyingcrane
  • πŸ‡­πŸ‡·Croatia Aporie

    I think a proper way of doing that would be to create a new condition in the payment gateway:

    Regarding the fact that it's the default option, I think it's just a matter of reorganizing your payment methods under admin/commerce/config/payment-gateways.

    As a workaround, you can probably perform checks and hide or display "create a wallet" button according to the order currency within the following preprocess: hook_preprocess_commerce_checkout_pane

  • πŸ‡ΊπŸ‡ΈUnited States iseeaflyingcrane

    Hi Aporie, I truly appreciate your prompt response. In my payment gateways, I have arranged the "Funds Balance" to be the last. However it still shows up at the default option in customer's payment options in the check out page.

    In terms of creating a a new condition, what condition should be set there? I already set the "Funds Balance" option to be available only to authenticated user. But the problem is that with authenticated users, not all of them has funds in their account. So I don't want the Wallet option to be the default.

    Thank you!

  • πŸ‡­πŸ‡·Croatia Aporie

    There is no such option out of the box, unfortunately.

    I was just pointing where the extra work should be done.

    Just keep the ticket opened and we'll see.

Production build 0.71.5 2024