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?
1 Answer
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.
-
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.– PlacidCommented Sep 6, 2015 at 12:09