• Resolved WebWizards

    (@webwizardsdev)


    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 1 year, 4 months ago by WebWizards.
    • This topic was modified 1 year, 4 months ago by WebWizards.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Oscar Gare

    (@oscargare)

    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” for the plugin does not load the pricing zone.
    Note that this hook runs on the WordPress init hook.

    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

    (@webwizardsdev)

    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.