Find Jobs
Hire Freelancers

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

₹600-1500 INR

Avslutat
Publicerad nästan fem år sedan

₹600-1500 INR

Betalning vid leverans
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.
Project ID: 19986925

Om projektet

5 anbud
Distansprojekt
Senaste aktivitet fem år sedan

Ute efter att tjäna lite pengar?

Fördelar med att lägga anbud hos Freelancer

Ange budget och tidsram
Få betalt för ditt arbete
Beskriv ditt förslag
Det är gratis att registrera sig och att lägga anbud på uppdrag

Om kunden

Flagga för INDIA
Delhi, India
5,0
5
Verifierad betalningsmetod
Medlem sedan sep. 10, 2015

Kundverifikation

Tack! Vi har skickat en länk för aktivering av gratis kredit.
Något gick fel med ditt e-postmeddelande. Vänligen försök igen.
Registrerade Användare Totalt antal jobb publicerade
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Laddar förhandsgranskning
Tillstånd beviljat för geolokalisering.
Din inloggningssession har löpt ut och du har blivit utloggad. Logga in igen.