• Resolved keendev

    (@keendev)


    Hi,

    Just a heads up however it appears that Woocommerce Table Rate Shipping (https://www.woothemes.com/products/table-rate-shipping/) has made some changes as to how it registers rates. We started to notice that secondary currencies were not outputting the correct rates, we later found out that the currency prices were being converted twice. After some digging we found this piece of code in inc/currencies/class-wcml-multi-currency-shipping.php :

    if(
                    isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
                    || preg_match('/^table_rate-[0-9]+ : [0-9]+$/', $k)
                ){
                    continue;
                }

    This no longer works in Woocommerce Table Rate Shipping 3.0.0. Im not sure if older versions are affected. It seems like the method key has changed. Before it use to be table_rate-x : x however it is now only x : x So when i change your code to the following:

    if(
                    isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
                    || preg_match('/^[0-9]+ : [0-9]+$/', $k)
                ){
                    continue;
                }

    It will start to emit the correct rates. My fix might not be the best as now it is very generic, maybe it can be improved to be something like

    if(
                    isset($shipping_methods[$method->id]) && isset($shipping_methods[$method->id]->settings['type']) && $shipping_methods[$method->id]->settings['type'] == 'percent'
                    || (preg_match('/^[0-9]+ : [0-9]+$/', $k) && $method->method_id == 'table_rate')
                ){
                    continue;
                }

    Thanks for the great plugin ??

    https://www.ads-software.com/plugins/woocommerce-multilingual/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘No longer compatible with Woocommerce Table Rate Shipping (fix inside)’ is closed to new replies.