• Resolved seasicksteve

    (@seasicksteve)


    Just downloaded and activated this plugin on my test site and this is what happened:

    Fatal error: Uncaught Error: Call to a member function get_shipping_countries() on null in E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce-easy-table-rate-shipping\woocommerce-table-rate-plugin.php:1272 Stack trace: #0 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce-easy-table-rate-shipping\woocommerce-table-rate-plugin.php(144): JEMTR_Table_Rate_Shipping_Method->create_select_arrays() #1 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce-easy-table-rate-shipping\woocommerce-table-rate-plugin.php(90): JEMTR_Table_Rate_Shipping_Method->init() #2 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce\includes\class-wc-shipping.php(199): JEMTR_Table_Rate_Shipping_Method->__construct() #3 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce\includes\class-wc-shipping.php(177): WC_Shipping->register_shipping_method(‘JEMTR_Table_Rat…’) #4 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\bb-zoho-connector\classes\bbz-wc-gateway-account.php(79): WC_Shipping->load_shipping_methods() #5 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\bb-zoho-connector\classes\bbz-wc-gateway-account.php(33): bbz_wc_gateway_account->init_form_fields() #6 E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\bb-zoho-connector\bb-zoho-connector-plugin.php(114): bbz_wc_gateway_account->__construct() #7 E:\OneDrive\Development\htdocs\bbtest\wp-includes\class-wp-hook.php(308): bbz_init_account_payment_gateway(”) #8 E:\OneDrive\Development\htdocs\bbtest\wp-includes\class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #9 E:\OneDrive\Development\htdocs\bbtest\wp-includes\plugin.php(517): WP_Hook->do_action(Array) #10 E:\OneDrive\Development\htdocs\bbtest\wp-settings.php(486): do_action(‘plugins_loaded’) #11 E:\OneDrive\Development\htdocs\bbtest\wp-config.php(68): require_once(‘E:\\OneDrive\\Dev…’) #12 E:\OneDrive\Development\htdocs\bbtest\wp-load.php(50): require_once(‘E:\\OneDrive\\Dev…’) #13 E:\OneDrive\Development\htdocs\bbtest\wp-blog-header.php(13): require_once(‘E:\\OneDrive\\Dev…’) #14 E:\OneDrive\Development\htdocs\bbtest\index.php(17): require(‘E:\\OneDrive\\Dev…’) #15 {main} thrown in?E:\OneDrive\Development\htdocs\bbtest\wp-content\plugins\woocommerce-easy-table-rate-shipping\woocommerce-table-rate-plugin.php?on line?1272

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Alexandru Tapuleasa

    (@talextech)

    I don’t really know what could cause that. That function calls just gets the list of shipping countries from WooCommerce using the WooCommerce get_shipping_countries() function but apparently the countries object in WooCommerce is null ??

    Try adding some shipping zones maybe that will reset it.

    Thread Starter seasicksteve

    (@seasicksteve)

    I hadn’t expected to have to debug this! ??

    I ran a little test and inserted the following code ahead of line 1272 in the code:
    $WC = WC();
    $countries = $WC->countries;
    $shipping_countries = $countries->get_shipping_countries();

    The error occurred on the third line, which suggests that WC()->countries hadn’t been initialised when this code was called.

    This works

    $WC_Countries = new WC_Countries();
    // Get the country list from Woo....
    foreach ($WC_Countries->get_shipping_countries() as $id => $value) :
       $this->country_array[esc_attr($id)] = esc_js($value);
    endforeach;

    FYI I’m on the latest version of Woocommerce 7.9.0 and the shipping country restrictions are left as default (i.e.’all’)

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    Thanks for writing that, we didn’t have any other reports of this but will look into it, maybe add an if() there to check if it’s not null

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error’ is closed to new replies.