Title: How can I predefine location programatically?
Last modified: August 3, 2021

---

# How can I predefine location programatically?

 *  Resolved [acidpunk25](https://wordpress.org/support/users/acidpunk25/)
 * (@acidpunk25)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/)
 * I need to choose location before I go to catalog and then depending on selected
   location show stock quantity for each product. How can I achieve that with code?
 * P.S. A little documentation for plugin would be pretty cool

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14739788)
 * Hi [@acidpunk25](https://wordpress.org/support/users/acidpunk25/)
 * You mean set a default location that will be displayed as primary?
 *  Thread Starter [acidpunk25](https://wordpress.org/support/users/acidpunk25/)
 * (@acidpunk25)
 * [4 years, 10 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14756909)
 * Hi [@alexmigf](https://wordpress.org/support/users/alexmigf/)!
 * What I mean – somehow I need to make select for location before catalog or cart,
   on simple page. Then I need to hide location on catalog and cart and use preselected
   value for location from selection which was made on simple page. So, question
   is how can I use location id (storing in session for example) to use it in location
   select with code so user don’t need to select again location?
 *  [Muhammad Usman](https://wordpress.org/support/users/usman661/)
 * (@usman661)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14839261)
 * Hi, I need a similar function in my store. When a user visits the website, a 
   popup opens and the user can select the location. Then only products from that
   location will be shown to that user. How can I achieve this. Or is there any 
   dropdown for the shop page to show products only in that shop?
 *  [nassonline](https://wordpress.org/support/users/nassonline/)
 * (@nassonline)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14889845)
 * This is surely a great ideas as Mr Usman said.
 *  [nassonline](https://wordpress.org/support/users/nassonline/)
 * (@nassonline)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14900198)
 * Hi,
    No response from Developer.
 *  [titsmaker](https://wordpress.org/support/users/titsmaker/)
 * (@titsmaker)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14946867)
 * I am interested in that kind of feature too.
    In my case I want user to select
   a location via popup or we can use information from WooCommerce geolocation. 
   Then some stock routing should take place: – for Zone A we show stock from Location
   A, but if product is not in stock there then we show stock from Location B – 
   for Zone B we show only stock from Location B
 *  [nassonline](https://wordpress.org/support/users/nassonline/)
 * (@nassonline)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-14947129)
 * Hi titsmaker (@titsmaker),
    Its a good suggestion, but the developer is still
   silent. Whgat can we do. It is a great plugin to use for woocommerce.
 *  Plugin Author [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * (@fahadmahmood)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-15140928)
 * Hi All,
 * Another user suggested something related to filter on shop page. So this feature
   can be associated with the shop page filter as well. So when we will filter products
   on shop page by location selection, any product clicked/opened from there will
   have this location pre-selected, which would be fine. And for now default location
   selection feature is already available in this plugin. Please help me to understand
   your idea better if I am missing something in it.
 * Thanks,
    Fahad

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘How can I predefine location programatically?’ is closed to new replies.

 * ![](https://ps.w.org/stock-locations-for-woocommerce/assets/icon.svg?rev=2471943)
 * [Stock Locations for WooCommerce](https://wordpress.org/plugins/stock-locations-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stock-locations-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stock-locations-for-woocommerce/reviews/)

 * 8 replies
 * 6 participants
 * Last reply from: [Fahad Mahmood](https://wordpress.org/support/users/fahadmahmood/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/how-can-i-predefine-location-programatically/#post-15140928)
 * Status: resolved