How to enable paypal for customer to pay via customer invoice?
-
Hi,
I had setup 2 payment method which are paypal and International Order(renamed from COD).I wanted the local country (SG) to be able to pay ONLY via Paypal while for other country customer, they will select international order to place an order, I will then calculate and add shipment charge backend and send them a customer invoice to pay.
I checked solutions on the net and found this function snippet:
function payment_gateway_disable_country( $available_gateways ) {
global $woocommerce;
if ( isset( $available_gateways[‘paypal’] ) && $woocommerce->customer->get_country() <> ‘SG’ ) {
unset( $available_gateways[‘paypal’] );
} else if ( isset( $available_gateways[‘cod’] ) && $woocommerce->customer->get_country() == ‘SG’ ) {
unset( $available_gateways[‘cod’] );
}
return $available_gateways;
}
add_filter( ‘woocommerce_available_payment_gateways’, ‘payment_gateway_disable_country’ );The above solved the problem of hiding and setting the right payment method for local SG customers and International customers when they place an order.
However, I noticed the customer invoice only has the International Order (i.e. COD) payment method as I understood the Paypal was unset. May I know is there a way to tweak the function to enable Paypal Only on customer invoice? I need this solution to apply to all users including guest.
Thanks!
- The topic ‘How to enable paypal for customer to pay via customer invoice?’ is closed to new replies.