Find Jobs
Hire Freelancers

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

₹600-1500 INR

Imefungwa
Imechapishwa almost 5 years ago

₹600-1500 INR

Kulipwa wakati wa kufikishwa
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.
Kitambulisho cha mradi: 19986925

Kuhusu mradi

5 mapendekezo
Mradi wa mbali
Inatumika 5 yrs ago

Unatafuta kupata pesa?

Faida za kutoa zabuni kwenye Freelancer

Weka bajeti yako na muda uliopangwa
Pata malipo kwa kazi yako
Eleza pendekezo lako
Ni bure kujiandikisha na kutoa zabuni kwa kazi

Kuhusu mteja

Bedera ya INDIA
Delhi, India
5.0
5
Njia ya malipo imethibitishwa
Mwanachama tangu Sep 10, 2015

Uthibitishaji wa Mteja

Asante! Tumekutumia kiungo cha kudai mkopo wako bila malipo kwa barua pepe.
Hitilafu fulani imetokea wakati wa kutuma barua pepe yako. Tafadhali jaribu tena.
Watumiaji Waliosajiliwa Jumla ya Kazi Zilizochapishwa
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Onyesho la kukagua linapakia
Ruhusa imetolewa kwa Uwekaji wa Kijiografia.
Muda wako wa kuingia umeisha na umetoka nje. Tafadhali ingia tena.