Skip to content

Instantly share code, notes, and snippets.

@ChromeOrange
Created March 28, 2014 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ChromeOrange/9832001 to your computer and use it in GitHub Desktop.
Save ChromeOrange/9832001 to your computer and use it in GitHub Desktop.
Set the WooCommerce store city and zipcode / postcode
/**
* Set the store base city and postcode / zipcode
*/
add_filter( 'woocommerce_countries_base_city' , 'set_woocommerce_countries_base_city' );
function set_woocommerce_countries_base_city() {
// Replace with your store town/city
return 'Townland';
}
add_filter( 'woocommerce_countries_base_postcode' , 'set_woocommerce_countries_base_postcode' );
function set_woocommerce_countries_base_postcode() {
// Replace with your store postcode / zipcode
return '45040';
}
@dacampbe
Copy link

What file do I place this in?

@ChromeOrange
Copy link
Author

Your theme functions.php file

@ofernandolopes
Copy link

How do I configure more than one postcode at the same time? Just duplicate the code or do I postcodes separated by commas?

@ChromeOrange
Copy link
Author

@ofernandolpes you can't, WooCommerce only supports one store address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment