Support » Plugin: Checkout Field Editor (Checkout Manager) for WooCommerce » Use of full state names rather than state codes

  • Resolved allancaeg

    (@allancaeg)


    My logistics and shipping provider is unable to match State address records.

    Apparently, this is because our checkout swaps full state names with state codes.

    E.g. “Leyte” region in Philippines is recorded as “LEY”.

    Is the plugin setting this for State validation, and how might I revert to fully spelled out State names?

    Cheers!

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    This is the default behavior of WooCommerce. However, we are checking whether there is any default WooCommerce hook available inorder to achieve your requirement.

    We will get back to you as soon as possible.

    Thank you!

    Thread Starter allancaeg

    (@allancaeg)

    I appreciate it!

    Plugin Author ThemeHigh

    (@themehigh)

    By default, WooCommerce is saving the value as State code. We are not sure whether making modifications to it cause any unexpected errors.

    You can try using the below code to get the state name from the state code.

    $order = wc_get_order($order_id);
    $country = $order->get_billing_country();
    $state = $order->get_billing_state();
    echo WC()->countries->get_states( $country )[$state];
    

    Here the $order_id is the id of your order.

    We hope this helps.

    Thank you!

    Thread Starter allancaeg

    (@allancaeg)

    Hi!

    I’m using this plugin to add code snippets.

    Just tried adding the code above, but it took my site down.

    Can you guide how I’d use that code?

    Thank you!!

    Plugin Author ThemeHigh

    (@themehigh)

    Using the code that we have provided you can show the state in the place that you needed. Can you please let us know whether you would like to change the state code to the state name on all the places where it is shown? If so, unfortunately, it is not possible to achieve this.

    Please note that by default WooCommerce is showing the state code, hence making changes to this behavior can cause unexpected errors.

    We hope this answer your questions.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.