PHP code minimum order value only applies to default currency
-
Hello everyone,
I use the Curcy plugin to offer my customers multi-currency payments.
Everything works fine so far, I just have one problem.
I am using a PHP code to set a minimum order value for a specific payment method.
Unfortunately, this only works for the default currency (400 €).
But if someone pays with e.g. Hungarian Forint, he can already pay from 1€ (400 Forint).
Maybe someone can help me?
I use the following code:
add_filter( 'woocommerce_available_payment_gateways', 'show_hide_cod_payment_gateway' );
function show_hide_cod_payment_gateway( $available_gateways ) {
// Only on checkout page
if ( ! ( is_checkout() && ! is_wc_endpoint_url() ) )
return $available_gateways;
// Set the targeted cart total
$targeted_total = 400;
// Check if the order total is less than or equal to the minimum for COD payment
if ( WC()->cart->total <= $targeted_total && isset($available_gateways['cod']) ) {
unset($available_gateways['cod']);
}
return $available_gateways;
}
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘PHP code minimum order value only applies to default currency’ is closed to new replies.