• Since updating WP to 4.2.2 I lost all my Shipping Zones, and when I try to recreate them I get the error: “Sorry, a zone with the given ID could not be found.”

    I have selling to specific countries checked on the General Tab for Guernsey, Jersey and United Kingdom.

    I select ‘Add New’ from the Shipping Zone tab, select ‘countries/states’ under ‘type, select one of my countries in the ‘countries’ box and then save. I get both a ‘saved successfuly’ message and “Sorry, a zone with the given ID could not be found.”

    This has effectively shut down the shop, so is exceptionally urgent!

    https://www.ads-software.com/plugins/woocommerce-table-rate-shipping/

Viewing 15 replies - 1 through 15 (of 19 total)
  • bump

    Anonymous User 13967495

    (@anonymized-13967495)

    I know this is a bit out of date but it might help someone.

    I experienced the same issue, the shipping zones had all disappeared and adding them back led to the error Igoro was seeing.

    I’ve done some digging and the shipping zones are still present in the database – they’ve not been deleted. The problem appears to be with some code in the following script:

    /wp-content/plugins/woocommerce-table-rate-shipping/inc/zone-list-table.php

    There is some construct code at the top which should be calling the shipping zones out of the db when called by various functions, this doesn’t work… I’m not sure why perhaps it’s a wordpress/woocommerce update that’s tightened up some code.

    There’s probably a more elegant solution but I managed to fix it with a hack. Please be aware this may only be a solution for sites that are already running the plugin – I’m not sure if it would work on new installs as I’ve removed a line of code that may be important! take a backup of the file first and use this at your own risk!

    1) comment out line 239 which looks like:

    $data = (isset($this->shipping_zones) && is_array($this->shipping_zones)) ? array_filter( (array) $this->shipping_zones ) : array();

    2) Replace it with:

    $data = get_option( 'be_woocommerce_shipping_zones' );

    This will force a fresh call to the database for the zone data

    3) Upload the change

    4) Check the zone list in the admin area and you should see them all again.

    5) Comment out line 348 which looks like:

    $shipping_zones = $zoneListTable->shipping_zones;

    6) Replace it with:

    $shipping_zones = get_option( 'be_woocommerce_shipping_zones' );

    This will fix the ‘edit’ screen for the zones.

    7) Upload the change

    8) Check the edit zone page in the admin area.

    Good luck!

    If the script gets updated in the future you’ll need to re-do this fix each time (unless of course the original developer sorts it!)

    Cheers,

    Luke

    Anonymous User 13967495

    (@anonymized-13967495)

    Found another related issue on the Shipping rates page itself which was again causing the zones not to load data properly and display a ‘foreach()’ error.

    The overall problems looks to me like a wordpress function has been used that has now been changed and has borked it. The WP List Table function. Again the fix below is a bit of a hack, take a backup and use at your own risk.

    1) Download the following file:
    /wp-content/plugins/woocommerce-table-rate-shipping/inc/zone-list-table.php

    2) Comment out line 189 which looks like:

    $zones = $zoneList->shipping_zones;

    3) Replace it with:

    $zones = get_option( 'be_woocommerce_shipping_zones' );

    4) Upload the change

    5) Check the shipping rate page and the zone values should be appearing again.

    Good Luck!

    Luke

    Lukenumum—you are awesome. That worked. THANK YOU!

    Anonymous User 13967495

    (@anonymized-13967495)

    @jessicasunlee glad it helped you! ??

    @lukenukum , Thanks for your help. But we can’t find: $zones = $zoneList->shipping_zones; at zone-list-table.php. If any good idea to fix it?

    my email: [email protected]

    Thanks and waiting for your kindly reply.

    Rico

    Anonymous User 13967495

    (@anonymized-13967495)

    @ricor it looks like i listed the wrong file in my instructions. the code is actually in:

    /wp-content/plugins/woocommerce-table-rate-shipping/inc/woocommerce-shipping-zones.php

    That should sort it!

    @lukenukum. It worked! thanks you so much. If you visit Xiamen, China some day. let me know. I will treat you! ahaha…

    Anonymous User 13967495

    (@anonymized-13967495)

    @ricor haha! thank you, you’re very kind! glad it worked for you ??

    @lukenukum Thank you! This worked brilliantly for the missing zones, but also all of my tables rates are missing, and I was getting that same error when trying to add one. After using your hack, I don’t get an error anymore when adding a table rate, but the table rate disappears after adding it as if it was never added. I suspect they are also in the database still. Can you possible help?

    Anonymous User 13967495

    (@anonymized-13967495)

    @mralls, hi… hmmm… i’m not sure, did you definitely follow all the steps in my first post up there?

    i guess it could be a different version you’re running? the one i was on was 3.5.3

    @lukenukum yes I definitely did follow the steps, and it worked for the shipping zones, but my shipping table rates are still missing. I know they’re in the database, though.
    Version 3.5.2 is what it’s telling me, but I don’t see an option to update that plugin.

    Anonymous User 13967495

    (@anonymized-13967495)

    @mralls it’s strange… but i must admit i’ve not had to add in any new table-rates yet, the hack just meant i could see all the old ones again.

    wish i could help further but it’s a bit of a can-of-worms this one! im hoping to change to another better supported plugin…

    @lukenukum
    I can see the old zones, just not the table rates. Well, thanks for your help, anyway! At least my problem is half fixed.

    Hello, I am using wordpress 4.3 but I can’t use the shipping plugin onto my website
    I am get same error Sorry, a zone with the given ID could not be found
    Plzz Help me

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘"Sorry, a zone with the given ID could not be found."’ is closed to new replies.