Find Jobs
Hire Freelancers

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

₹600-1500 INR

Zaprt
Objavljeno pred skoraj 5 leti

₹600-1500 INR

Plačilo ob dostavi
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.
ID projekta: 19986925

Več o projektu

5 ponudb
Projekt na daljavo
Aktivno pred 5 leti

Želite zaslužiti?

Prednosti oddajanja ponudb na Freelancerju

Nastavite svoj proračun in časovni okvir
Prejmite plačilo za svoje delo
Povzetek predloga
Registracija in oddajanje ponudb sta brezplačna

O stranki

Zastava INDIA
Delhi, India
5,0
5
Plačilna metoda je verificirana
Član(ica) od sep. 10, 2015

Verifikacija stranke

Hvala! Po e-pošti smo vam poslali povezavo za prevzem brezplačnega dobropisa.
Pri pošiljanju vašega e-sporočila je šlo nekaj narobe. Poskusite znova.
Registrirani uporabniki Skupaj objavljenih del
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Nalaganje predogleda
Geolociranje je bilo dovoljeno.
Vaša prijavna seja je potekla, zato ste bili odjavljeni. Prosimo, da se znova prijavite.