Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Minimum Order Amount Restriction for Klarna Payments #891

Open
beljp opened this issue Mar 6, 2024 · 1 comment
Open

Comments

@beljp
Copy link

beljp commented Mar 6, 2024

I propose a feature addition to enable setting minimum order values for specific payment methods, like Klarna. This functionality would allow usuers to manage payment methods on small orders. Currently, the absence of such a feature limits our ability to optimize payment strategies based on order size.

Incorporating a minimum order value requirement for certain payment options could greatly enhance merchant control and financial efficiency. I hope to see this feature considered for implementation to benefit a wide range of Mollie users.

Thank you for your support and commitment to improving the platform.

@InpsydeNiklas
Copy link
Collaborator

Hello @beljp, while there is currently no setting to control min/max amounts directly in the Mollie plugin, the availability of payment methods in WooCommerce can be controlled by certain third-party plugins, or with a code snippet like this:

add_filter('woocommerce_available_payment_gateways', function($available_gateways) {
    // Define your minimum and maximum amounts
    $min_amount = 50;
    $max_amount = 500;

    // Define which payment methods should be restricted
    $restricted_payment_methods = array(
        'mollie_wc_gateway_klarnapaylater',
        'mollie_wc_gateway_klarnasliceit',
        'mollie_wc_gateway_klarnapaynow',
        'mollie_wc_gateway_klarna'
    );

    // Get the cart total
    $cart_total = WC()->cart->total;

    // Loop through the restricted payment methods
    foreach ($restricted_payment_methods as $payment_method) {
        if (isset($available_gateways[$payment_method])) {
            // Remove payment method if the cart total is outside the specified range
            if ($cart_total < $min_amount || $cart_total > $max_amount) {
                unset($available_gateways[$payment_method]);
            }
        }
    }

    return $available_gateways;
});

Adding this functionality directly in the plugin is on the roadmap, but it will take a bit more time. I hope this helps you for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants