• Resolved Sol Aveiro

    (@soarveca)


    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;
    }//
    }//fin

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there 👋

    /wp-content/themes/generatepress_child/functions.php:593

    While checking the error log, I can see that it is coming from your theme (GeneratePress) functionalities, exactly from the functions.php file. You can confirm that by temporarily switching to Storefront Theme to see if that resolves the issue.

    If it does resolve the issue, please reach out to your theme’s developers for a solution.

    Please kindly note that this particular forum is for questions that are directly related to the features and functionality of the free WooCommerce plugin. While we’re experts on our own products, third party plugins are best supported by their own resp. developers (and more importantly, I’d rather not give you any incorrect information).

    I hope that helps! 🙂

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

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.