• Vijay Hardaha

    (@vijayhardaha)


    CRITICAL Uncaught Error: Call to a member function get_billing_country() on null

    Getting this error with the POS plugin. Reason get_icon function is being called in backend and you have a filter is hooked with get_icon filter of woocommerce and in your filter, you have used this function WC_Checkoutcom_Utility::get_alternative_payment_methods()

    in that function WC()->customer is null and get_billing_country() is being called on null so this is causing the issue.

    Please add the null or empty check before calling the WC()->customer->get_billing_country() to avoid this conflict.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Vijay Hardaha

    (@vijayhardaha)

    Other issues (NOTICE & WARNING) are because of bad coding standards.

    inside the function callback_for_setting_up_scripts() get_option() is used to get the settings array, but by default value is empty, mean it return null/false but without checking the empty condition the array offsets are being compared for conditions.

    for example: $google_pay_enabled = $google_settings['enabled'] == true ? true : false;
    here in null/false enabled can’t exist so it gives the error.
    although this can be solved by saving all the forms in the backend then the new error comes in and that is because of the wrong way of comparing.

    $google_settings['enabled'] == true you see here we checking string with boolean so it’s always true.

    since you registered the checkbox using woocommerce admin settings to it saves the checkbox in “yes” and “no” no in the format of true false.

    so you need to make a strict comparison here.
    $google_settings['enabled'] === "yes" like this or you can use wc_string_to_bool and check compare it with boolean.

    now since it’s true then
    if ($apm_enable) this check validates and then
    foreach ($apm_settings['ckocom_apms_selector'] as $value)
    this line runs and you’ll see that ‘ckocom_apms_selector’ is saved as a string in the database. so you’re looping a string and here another error comes in.

    you must validate all these data before processing anything with it.

    Hope this information will help improve code quality.

    Looking for a response.
    thanks.

    Thread Starter Vijay Hardaha

    (@vijayhardaha)

    The refund button is hidden in all the orders in the backend. because in your function action_woocommerce_order_item_add_action_buttons custom js code it loading without checking the condition.

    Thread Starter Vijay Hardaha

    (@vijayhardaha)

    Found another warning error

    PHP Warning: Use of undefined constant WC_Subscriptions_Order - assumed 'WC_Subscriptions_Order' (this will throw an Error in a future version of PHP) in /public_html/wp-content/plugins/checkout-com-unified-payments-api/includes/class-wc-gateway-checkout-com-cards.php on line 509

    This is happening because WC_Subscriptions_Order is not quoted with ” so being treated as constant.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CRITICAL Uncaught Error on get_billing_country()’ is closed to new replies.