Finish order without Payment Method
-
Hello,
I am trying to modify the behavior of finish shop. If I have some condition I unset the payment methods, and this works fine, but it give me an ERROR “invalid payment method” and I can’t finish the order.
This his the function who unset the payment methods.
add_filter(‘woocommerce_available_payment_gateways’, ‘payment_gateway_disable_country’);
function payment_gateway_disable_country($available_gateways) {
global $woocommerce;
if (($woocommerce->customer->get_country() <> ‘PT’ && $woocommerce->customer->get_shipping_country() <> ‘PT’)) {
unset($available_gateways[‘bacs’]);
unset($available_gateways[‘cheque’]);
unset( $available_gateways[‘authorize’] );
return;
}if (($woocommerce->customer->get_country() <> ‘ES’ && $woocommerce->customer->get_shipping_country() <> ‘ES’)) {
unset($available_gateways[‘bacs’]);
unset($available_gateways[‘cheque’]);
unset( $available_gateways[‘authorize’] );
return;
}
return $available_gateways;
}Do you know how can cross this problem?
The topic ‘Finish order without Payment Method’ is closed to new replies.