• Resolved frischi

    (@frischi)


    Hello,
    I hope you can help me here.

    In wordpress woocommerce I get ampty arrays if I use WC()->countries->get_states().

    This is the return:
    state:
    AF: []
    AT: []
    AX: []
    BE: []
    BH: []
    BI: []
    CZ: []
    DE: []
    DK: []
    EE: []
    FI: []
    FR: []
    GF: []
    GP: []
    IL: []
    IM: []
    IS: []
    KR: []
    KW: []
    LB: []
    LK: []
    LU: []
    MQ: []
    MT: []
    NL: []
    NO: []
    PL: []
    PT: []
    RE: []
    SE: []
    SG: []
    SI: []
    SK: []
    VN: []
    YT: []

    I`m sure, that some months before only a few arrays were empty and some had properties. Does anybody know how this could happen?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The list should include “allowed” countries, so what setting have you got at:
    Dashboard > WooCommerce > settings > General tab > Selling locations? I think you’ll need to set either “Sell to all countries” or “Sell to specific countries” + include the countries you want the states for. Sorry not tested.

    Thread Starter frischi

    (@frischi)

    Thanx very much, I switched to “Sell to all countries” and it works now. Before the changes I had only germany. And all arrays were empty. Also the german one.

    Germany has no WooCommerce states. The countries which have states are in the folder:
    wp-content/plugins/woocommerce/i18n/states/…

    Kenin

    (@kbassart)

    Automattic Happiness Engineer

    Hi there,

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WC()->countries->get_states() returns empty arrays’ is closed to new replies.