• Resolved mo7900

    (@mo7900)


    Hi there,

    We have been using LK custom states since 2013 without an issue (using this > https://docs.woocommerce.com/document/addmodify-states/). We recently trimmed down the state amounts and re-added the file and everything works fine with woo table rates shipping plugin and front-end.

    However, now under woocommerce>settings> Country/State field, once we select and save the LK country and it’s state (Which opens/loads fine with our new list of states), it does not stay saved.

    We tried other countries and states which comes default with WooCommerce, and they save fine. Our previous state file saved it fine as well.

    Is it something to do with WooCommerce or the Database not letting it save? since the state file format is the same and we simply reduced the amount of cities.

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    I took a quick peek at the filter you posted and at first glance it looks ok. I also tried to use the filter on my test site quickly and that also produced the estimated result.

    When you say

    However, now under woocommerce>settings> Country/State field, once we select and save the LK country and it’s state (Which opens/loads fine with our new list of states), it does not stay saved.

    do you mean here: https://cld.wthms.co/WcxYGb

    Could you post your code and we can try and reproduce.

    Thread Starter mo7900

    (@mo7900)

    Hi Con,

    Thanks a-lot for the reply.

    Your screenshot is spot on, that’s the place.

    Below find the pastiebin LK file we use (we simply reduced the amount of cities from previous file), again everything works fine in the back-end with Woo Table Rate Shipping as well as with the front-end rates and cities. Only the above mentioned issue persist.

    Also we have added the file in the child theme, and calling it via functions.php to load.

    https://www.pastiebin.com/embed/5cf57467b922d

    Thread Starter mo7900

    (@mo7900)

    Here is the code added in the functions.php file;

    https://pastiebin.com/embed/5cf62f8691f83

    Thank you!

    Thread Starter mo7900

    (@mo7900)

    we set up a new site, domain, our theme, db, and tried the new file, the issue is still there. Any help on this?

    Moderator Hari Shanker R

    (@harishanker)

    Hi @mo7900

    Sorry for the delay in getting back to you on this.

    we set up a new site, domain, our theme, db, and tried the new file, the issue is still there. Any help on this?

    This is interesting. Because, I tried adding the code to my site, and I was able to see all the custom states you added. Here’s a screenshot: https://cld.wthms.co/An4XLX

    Am I missing something here?

    Can you install the Code Snippets Plugin in your site and then try adding the code there?

    In case that doesn’t work either, I’d recommend doing a full conflict test as mentioned in this document: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Does this help in resolving the problem?

    Let us know how that went.

    Thread Starter mo7900

    (@mo7900)

    Hi Hari,

    Thanks for the reply.

    We do see all the custom states in the same area as your screenshot as well. Our issue is once we select one of those states (eg: Colombo 7) and click “Save”, that state doesn’t “stay” saved. It simply shows “Aland Island” as the saved country/state.

    Can you save a LK custom state there on your install, does it stay saved?

    Thank you!

    Moderator Hari Shanker R

    (@harishanker)

    Hi @mo7900

    We do see all the custom states in the same area as your screenshot as well. Our issue is once we select one of those states (eg: Colombo 7) and click “Save”, that state doesn’t “stay” saved. It simply shows “Aland Island” as the saved country/state.

    I tried replicating this problem locally. I tried creating a Sri Lanka zone, added multiple states to it, and saved the same.

    As you can see in the screencast below, the regions appear to remain saved: https://cld.wthms.co/oPNdUW

    Could you look at your PHP Error log or WooCommerce > Status > Logs for any errors? You might also want to try out a full conflict test and then test this out to see if the states get saved. More on how to do a conflict test here: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Let us know how that went.

    Thread Starter mo7900

    (@mo7900)

    Hi Hari,

    Thank for the reply again.

    But the issue is not on the shipping zones area. Those work fine for us as well, as mentioned in my first post, states are not saving in the WOO>Settings page.

    As @conschneider asked via a screenshot here > https://cld.wthms.co/WcxYGb

    In that location, can you save a LK state and see if it stay’s saved? (the states shows up on the drop down fine, but once we select one and save, it doesn’t stay saved and shows the 1st country in the default woo setup “Aland Island”

    Thank you!

    Thread Starter mo7900

    (@mo7900)

    Hi there, any feedback on above? Thank you!

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @mo7900 I believe the issue here is that the snippet didn’t have an accurate description as to how to use it, so it was not applied correctly. In the snipped XX denotes the state, so you have added $states['LK']. The problem is that each state added needed to have LK prefixed before the number like this: 'LK1001' => __( 'Colombo 1', 'woocommerce' ),

    I have corrected the snippet and included it here:
    https://gist.github.com/jessepearson/642b68c2f50a491b10f9cdd4651b69c4

    I have tested this and it works in my store with WooCommerce 3.6.5.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Woo Settings > Country / State NOT Savings’ is closed to new replies.