Phone Orders For WooCommerce

Override shipping/billing city

The Phone Orders for WooCommerce plugin uses WooCommerce’s default city lists for billing and shipping addresses. In some workflows, you may need to replace these dynamic lists with a custom, fixed set of cities. This is particularly useful for stores that serve a specific region where the standard city names differ from the customer’s entered value, or when you want to enforce a limited selection. The code below overrides the billing and shipping city fields with a predefined, hard‑coded list.


The Complete Code Snippet

Visit “Settings” – “Custom fields” and add to section “Customer fields” following text (edit list for your needs)

Add the following PHP code to your child theme’s functions.php file or via the Code Snippets plugin.

Customisation Options

You can easily adapt the code to handle different scenarios.

Use a text field instead of a dropdown – Change the custom field definition to text:

The agent can then type any city name.

Use a radio button group for a smaller set – Replace select with radio:

Apply the override only to specific user roles – Add a condition based on the customer’s role:

Override only the billing city but keep the original shipping city – Remove the line $cart_customer->set_shipping_city( $city_code );.

Use a different meta key – Change city to any other key you define in the custom fields settings.

Have questions? Please submit a support request. We're always happy to help!

Phone Orders
for WooCommerce
PRO

From $120
Buy
✓ 30-day money-back guarantee