0

add_filter('woocommerce_available_payment_gateways', 'hide_stripe_for_india');
function hide_stripe_for_india($available_gateways) {
    if (is_admin()) return $available_gateways; // Only run on the front-end
     // Check if the customer is in India
    if (WC()->customer->get_billing_country() === 'IN') {
        unset($available_gateways['stripe']);
    }else{
  unset($available_gateways['razorpay']);
 }
     return $available_gateways;
}

Jagdish Sarma Asked question May 15, 2023
Add a Comment