Support » Plugin: WooCommerce - Table Rates » Error if “Local Countries” is void

  • If I leave void the “Local Countries” I have a error(see below).

    I Found the line and the solution can be is:

    Go to file woocommerce-table-rates/includes/class.tablerate.php on 187 line and change:

    
      if ( $localCountry == '' )
           $localCountry[] = $woocommerce->countries->get_base_country();
    

    to:

    
      if ( $localCountry == '' ){
           $localCountry = array();
           $localCountry[] = $woocommerce->countries->get_base_country();
    
      }
    

    Reference: https://bugs.php.net/bug.php?id=72430

    2017/08/23 13:37:32 [error] 3053#3053: *48197 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: [] operator not supported for strings in /home/forge/site.com/wp-content/plugins/woocommerce-table-rates/includes/class.tablerate.php:188
    Stack trace:
    #0 /home/forge/site.com/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php(207): rp_tablerates->calculate_shipping(Array)
    #1 /home/forge/site.com/wp-content/plugins/woocommerce/includes/class-wc-shipping.php(365): WC_Shipping_Method->get_rates_for_package(Array)
    #2 /home/forge/site.com/wp-content/plugins/woocommerce/includes/class-wc-shipping.php(253): WC_Shipping->calculate_shipping_for_package(Array, 0)
    #3 /home/forge/site.com/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1455): WC_Shipping->calculate_shipping(Array)
    #4 /home/forge/site.com/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1368): WC_Cart->calculate_shipping()
    #5 /home/forge/site.com/wp-content/plugins/woocomme" while reading upstream, client: 73.245.6.96, server: site.com, request: "GET /es/cart/ HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "site.com", referrer: "https://site.com/es/producto/protos-red-crianza/"

    If you add me as contributor I will fix that and other issues, Thanks.

    Jose Carlos Ramos Carmenates

  • The topic ‘Error if “Local Countries” is void’ is closed to new replies.