Unable to Make the “City” Field Optional at WooCommerce Checkout
-
Hello, esteemed WooCommerce community!
I’ve encountered a task that seemed quite straightforward at first glance, but all attempts to find a solution have been fruitless. My goal is to make the “City” field optional on the checkout page to simplify the process for my customers. Here are the steps I’ve already taken:
- Tried using the
woocommerce_checkout_fields
hook to change therequired
attribute of the city field tofalse
. - Used the
woocommerce_default_address_fields
hook with the same goal, attempting to change the mandatory nature of the “City” field at the level of all address fields. - Attempted to dynamically manage the
required
attribute of the “City” field using JavaScript depending on the selected shipping method. - Checked the source code of the page and WooCommerce settings to ensure there were no other reasons why the field remained mandatory.
- Also considered the possibility of a theme conflict or server caching by conducting tests on a clean WordPress installation with the Storefront theme and no active plugins except WooCommerce.
Unfortunately, despite all efforts, the “City” field still remains mandatory, and orders cannot be placed without filling it in.
P.S. I have also tried installing 3 or 4 of the most popular plugins for this purpose, and the disabling of the mandatory field does not work in them either.
I would be very grateful for any suggestions, advice, or directions for further actions. Perhaps some of you have faced a similar problem or know which method would be effective in this situation.
Thank you in advance for your time and help!
- Tried using the
- The topic ‘Unable to Make the “City” Field Optional at WooCommerce Checkout’ is closed to new replies.