Fermé

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.

Compétences : Javascript, PHP, WooCommerce, WordPress

en voir plus : 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

Concernant l'employeur :
( 5 commentaires ) Delhi, India

Nº du projet : #19986925

5 freelance font une offre moyenne de ₹2730 pour ce travail

rsen75

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 / Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% INR en 5 jours
(195 Commentaires)
7.1
shahajay6434

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 Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% INR en 1 jour
(61 Commentaires)
5.6
sonaphp247

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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% INR en 7 jours
(26 Commentaires)
4.1
milindaudichya

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 Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% INR en 7 jours
(7 Commentaires)
4.0
deepaksonidz

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, Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% INR en 1 jour
(1 Évaluation)
1.9