Uncaught Error: Call to a member function get_billing_state()
-
I have a issues with the function get_billing_state(); Theses is the error: “[05-Jun-2021 18:32:48 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_billing_state() on null in /home/perfume1/public_html/perfumeslujosos.com/wp-content/themes/generatepress_child/functions.php:593”
That would seem to indicate that WC()->customer is returning a null value.
//Deshabilitar pago en efectivo por ciudades add_filter( ‘woocommerce_available_payment_gateways’, ‘Deshabilitar_por_ciudad’); function Deshabilitar_por_ciudad ($available_gateways){ if ( is_admin() ) return $available_gateways; if ( isset( $available_gateways[‘authorize’] ) && WC()->customer->get_billing_state() <> ‘Asunción’ ) { unset( $available_gateways[‘authorize’] ); } else { if ( isset( $available_gateways[‘cod’] )) { // $aux = preventa_crema_blanqueadora(); /*if($aux > 0) { unset( $available_gateways[‘cod’] ); } */ if(!empty(WC()->customer->get_billing_state())) { $ciudad = WC()->customer->get_billing_state(); if($ciudad != ‘Asunción’ && $ciudad != ‘Lambare’ && $ciudad != ‘Fernando de la Mora’ && $ciudad != ‘Loma Pyta’ && $ciudad != ‘Villa Elisa’ && $ciudad != ‘Zeballos’ && $ciudad != ‘San Antonio’ && $ciudad != ‘San Lorenzo’ &&$ciudad != ‘Luque’ && $ciudad != ‘Mariano Roque Alonso’ && $ciudad != ‘Ñemby’ && $ciudad != ‘Limpio’ && $ciudad != ‘Capiata’ && $ciudad != ‘Ypané’ && $ciudad != ‘Areguá’ ) { unset( $available_gateways[‘cod’] ); } } } return $available_gateways; }// }//finThe page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Uncaught Error: Call to a member function get_billing_state()’ is closed to new replies.