0

In Woocommerce settings, if "sell to specific countries" is selected as single country, the checkout page shows the country and there is no option to select/change that. How is it possible to achieve the same for city field?

enter image description here

1 Answer 1

0

There is a simpler solution to this. The approach also depends on the some assumption which are listed below:

Assumption : If there is only one City which you want the City field to be set to then you can use jQuery. Using jQuery you will be setting the value of the field and make the fields disabled to avoid change in City field value.

A rough example will be :

jQuery('#billing_city').val('Mumbai').attr('disabled','disabled');

You just need to add this line such that it is execute on Checkout page.

1
  • Thank you so much for your answer. But if I disable it at front-end, its possible for users to disable javascript and enter other city names. Is it possible to fix this value with PHP/WordPress? Thanks again.
    – Placid
    Commented Sep 6, 2015 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.