Unset COD Payment Gateway on the Basis of Post Code in Woocommerce

I need to unset Cash on Delivery payment gateway on the basis of post code entered by the customer on checkout page. Currently, I have created a shipping zone with the list of pincoedes and I am using the following function to unset the gateway:

function conditionally_remove_payment_methods( $gateways ){

// Define Zone Check for Pincode

$targeted_zones_names = array('All','Zone 4','Zone 7');

$chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); // The chosen shipping mehod

$chosen_method = explode(':', reset($chosen_methods) );

$shipping_zone = WC_Shipping_Zones::get_zone_by( 'instance_id', $chosen_method[1] );

$current_zone_name = $shipping_zone->get_zone_name();

if( in_array( $current_zone_name, $targeted_zones_names ) && WC()->customer->get_billing_postcode() <> ''){

unset( $gateways['cod'] );


return $gateways;


The number of pincodes entered in the shipping zone is around 15,000. This is causing the checkout page to load in 25 seconds or more. I need a way to accomplish this without slowing down the checkout page loading.

Квалификация: Javascript, PHP, WooCommerce, WordPress

Показать больше aspnet post payment gateway, payment gateway aspnet using code, php free payment gateway code, net payment gateway post, payment gateway integration php code, indian payment gateway free php code, data payment gateway api integration code, optimal payment gateway integration php code, php payment gateway mastercard page code, hdfc payment gateway integration php code, connect payment gateway asp net code, payment gateway server side code, online payment gateway integration sample code, payment gateway wtih qr code, woocommerce payment gateway post, payment gateway with qr code, shopify shipping zones by zip code

О работодателе:
( 5 отзыв(-а, -ов) ) Delhi, India

ID проекта: #19986925

5 фрилансеров(-а) в среднем готовы выполнить эту работу за ₹2730


hi, 15+ years experience with strong knowledge of API / Payment Gateway integration and php with mysql, Plugin development and designing see my few portfolio **CSM and eCom** Magento / WordPress / zencart / Больше

₹8000 INR за 5 дней(-я)
(195 отзывов(-а))

Hi, I can update your website. Can we have a short discussion? I can start immediately and can complete the task within a short time. I am a full stack developer with over 7+ years of experience dealing with HTML Больше

₹1300 INR за 1 день
(61 отзывов(-а))

Hello, Greetings, Top most Freelancer to work with and have great reviews too. We have read your project details and we are very much keen to work with you. We have the best developer and designer team having more than Больше

₹1450 INR за 7 дней(-я)
(26 отзывов(-а))

Hello, I'm a freelancer with more than 5 years of work experience in designing websites in PHP, CakePHP, Wordpress, PHP, HTML/CSS/JAVASCRIPT, Wordpress Theme Integration, Woocommerce/E-commerce, Responsive Design. Coul Больше

₹900 INR за 7 дней(-я)
(7 отзывов(-а))

Hi, Greetings of the day!!! I carefully reviewed your requirement for quality services you can connect with me. I have more than 8 years of experience in Website & Mobile Application Designing & Development, HTML, Больше

₹2000 INR за 1 день
(1 отзыв)