Title: Fatal error
Last modified: July 28, 2023

---

# Fatal error

 *  Resolved [seasicksteve](https://wordpress.org/support/users/seasicksteve/)
 * (@seasicksteve)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-4503/)
 * 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](https://wordpress.org/support/users/talextech/)
 * (@talextech)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-4503/#post-16930488)
 * 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](https://wordpress.org/support/users/seasicksteve/)
 * (@seasicksteve)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-4503/#post-16930661)
 * 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
 *     ```wp-block-code
       $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](https://wordpress.org/support/users/talextech/)
 * (@talextech)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-4503/#post-16930695)
 * 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.

 * ![](https://ps.w.org/woocommerce-easy-table-rate-shipping/assets/icon-256x256.
   png?rev=2618390)
 * [Table Rate Shipping for WooCommerce](https://wordpress.org/plugins/woocommerce-easy-table-rate-shipping/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-easy-table-rate-shipping/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-easy-table-rate-shipping/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-easy-table-rate-shipping/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-easy-table-rate-shipping/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-easy-table-rate-shipping/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Alexandru Tapuleasa](https://wordpress.org/support/users/talextech/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/fatal-error-4503/#post-16930695)
 * Status: resolved