Title: Set currency programmatically
Last modified: November 14, 2023

---

# Set currency programmatically

 *  Resolved [WebWizards](https://wordpress.org/support/users/webwizardsdev/)
 * (@webwizardsdev)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/set-currency-programmatically/)
 * Hi there,
 * We are plugin developers and we are working on an integration between one of 
   our plugins and Price Based on Country.
 * We have a page in our plugin where the currency should always be the base currency(
   it’s a frontend dashboard page where we need to calculate things based on the
   base currency, we must not have price conversion here).
 * **Can you please tell me what code we could use to force set the currency to 
   the base currency?**
    -  This topic was modified 2 years, 4 months ago by [WebWizards](https://wordpress.org/support/users/webwizardsdev/).
    -  This topic was modified 2 years, 4 months ago by [WebWizards](https://wordpress.org/support/users/webwizardsdev/).

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

 *  Plugin Author [Oscar Gare](https://wordpress.org/support/users/oscargare/)
 * (@oscargare)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/set-currency-programmatically/#post-17200952)
 * Hi,
   There is no way to force the currency because **“Price Based on Country” 
   is not a currency switcher plugin.** Currency is a property of the pricing zone,
   and the pricing zone depends on the customer’s country.
 * You can use the filter “[wc_price_based_country_stop_pricing](https://plugins.trac.wordpress.org/browser/woocommerce-product-price-based-on-countries/trunk/includes/class-wc-product-price-based-country.php#L331)”
   for the plugin does not load the pricing zone. 
   Note that this hook runs on the
   WordPress[ init hook](https://codex.wordpress.org/Plugin_API/Action_Reference).
 * The code snippet `add_filter('wc_price_based_country_stop_pricing', '__return_true');`
   turns off the pricing zone loading, so WooCommerce works as default (shop base
   currency)
 *  Thread Starter [WebWizards](https://wordpress.org/support/users/webwizardsdev/)
 * (@webwizardsdev)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/set-currency-programmatically/#post-17202333)
 * Thank you for the great answer, it works.

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

The topic ‘Set currency programmatically’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-product-price-based-on-countries/assets/icon-
   256x256.png?rev=1976858)
 * [Price Based on Country for WooCommerce](https://wordpress.org/plugins/woocommerce-product-price-based-on-countries/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-product-price-based-on-countries/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-product-price-based-on-countries/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-product-price-based-on-countries/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-product-price-based-on-countries/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-product-price-based-on-countries/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [WebWizards](https://wordpress.org/support/users/webwizardsdev/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/set-currency-programmatically/#post-17202333)
 * Status: resolved