Hide Humm payment option when order is below minimum
-
Hey team,
I’m currently using your Flexicards LTFO Woo plugin, and I noticed that the payment option still shows at checkout even when the order total is below the minimum. This could potentially confuse customers who try to check out with Humm but don’t meet the minimum threshold.
To work around this, I created a small plugin using the woocommerce_available_payment_gateways filter to hide the Humm payment option when the cart total is below the required minimum.
add_filter('woocommerce_available_payment_gateways', function($available_gateways) {
if (is_admin()) return $available_gateways;
$gateway_id = 'flexicardsltfo-hummgroup';
if (isset($available_gateways[$gateway_id])) {
$cart_total = WC()->cart->total;
$min_order = 200; // Ideally this would be dynamic
if ($cart_total < $min_order) {
unset($available_gateways[$gateway_id]);
}
}
return $available_gateways;
});It works great, but I wanted to suggest a small improvement:
Would you consider exposing the minimum order amount as a public property or method on the gateway object (like $gateway->min_order_amount), or maybe even making it a setting in the plugin options?That way, we wouldn’t have to hardcode the minimum ourselves, and any future changes would automatically take effect.
Thanks for the great plugin and your time
Best,
Pedro from Legend
The topic ‘Hide Humm payment option when order is below minimum’ is closed to new replies.