• Resolved Nessdufrat

    (@nessdufrat)


    Hi !

    After 10 years I’m back in the business, so to say, and I decided to do a big update on the website. Updated wordpress to the latest release, and woocommerce to the latest release as well, so that both would support php 8.

    Now I’m getting an error message on the backoffice. The website works, I can add items to the basket, I haven’t really tried other stuff, I only have 7 books for sale so it’s a tiny shop, with maybe a sale each month. But this message is super annoying as it’s blocking the woocommerce interface and preventing it from loading on some of the pages.

    Here’s the full message :

    Warning: Undefined array key "AN" in?/monsite/wp-content/plugins/woocommerce/includes/class-wc-shipping-zone.php?on line?125

    And that’s line 124 to 126 :

    foreach ( $countries as $location ) {
    $location_parts[] = $all_countries[ $location->code ];
    }

    I checked my shipping zones and nothing out of place. I did a search already and aside from somebody who had trouble with a similar file but for the cities, I couldn’t find anything. I don’t have any country with region area AN, since I didn’t choose specific regions, only whole countries.

    The website is working, but like I said, it is annoying because some pages aren’t showing up properly on the backoffice.

    Thank you for your help ??

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Nessdufrat

    (@nessdufrat)

    So, after some extensive research in the database, I found out AN was the code for a country in the shipping zone “world”, which country, no idea, maybe it wasn’t even a country but a way to handle the address, so I had to go and add all the countries of the world to a “world” shipping zone, it took forever because I had to add them one by one (and who is the crazy person who decided tiny countries should have 20+ sub categories, like the smallest countries in Europe each had about 20 areas that I had to add manually… thankfully they didn’t do that with France and the departments otherwise I would still be at it).

    It solved the error… partially. It disappeared, but the page remains blank. Instead of the woocommerce backoffice, I get a blank page.

    Thread Starter Nessdufrat

    (@nessdufrat)

    Ok, forget about that, silly me, I was still on my really old browser and that’s why it didn’t load. You can consider the thread solved. However, I still think there’s really a lot to be done to make things better with this shipping thing, I have no idea which country / countries were triggering that error but it took forever fixing that silly thing, and I wish there was a way to simply select areas, like “Europe” “North America” “Asia” etc, without having to go through a huge list…

    • This reply was modified 2 years, 1 month ago by Nessdufrat.

    Hi,

    Thanks for your messages.

    I understand you would like to add a whole continent and its countries to the shipping zones. Typically, WooCommerce does not include continents by default, and you’ll want to add the list of the countries where you will deliver the products.

    Checking in GitHub I found a list of the countries per continent, using custom code you can implement that list on your site. Please note, custom is out of the scope of this support forum.

    You can get a developer to do that for you. I’d suggest checking the following resources:

    Kind regards.

    Thread Starter Nessdufrat

    (@nessdufrat)

    Thanks !

    I might get into coding it if I really need it. Used to be a programmer a lifetime ago ahaha.
    for now a reference sheet for the country codes would be awesome. I don’t know where to start looking. I could start digging in every single file but there’s surely a ressource somewhere. I half expected to find a table in the database matching country codes and names but nope.

    since you’re responsible for the plug-in support, can you explain the need for the list of all the tiny provinces in Ukraine, Moldavia, Serbia and what not? Was is user added?

    anastas10s

    (@anastas10s)

    Hi there @nessdufrat

    Thank you for reaching back, with further information on this.

    Just to note, the WooCommerce countries class stores country/state data and can be found at in package l10n. Feel free to learn more at the page linked here.

    Furthermore, the AN country code appears to be for the Netherlands Antilles. Documentation on how to add a new country in the countries list can be found linked here.

    Just to clarify, could you try with a fresh installation of WordPress, with only WooCommerce and the Storefront theme installed and activated, and see if the issue persists, please?

    I trust that points you in the right direction, but if you have more questions, let us know. We’re happy to help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Undefined array key ? AN ? class-wc-shipping-zone.php’ is closed to new replies.