woocommerce get_woocommerce_currency_symbol()

Your code should work, which means the issue might be in the database. You can check these 2 functions:
get_woocommerce_currency() and get_woocommerce_currency_symbol()

from the WooCommerce docs that shows that you are using the functions correct.

What is left is for you to start some troubleshooting steps to see what causes the error:

What is get_option('woocommerce_currency') returning? If nothing, then you have no currency set and that is why you get nothing from get_woocommerce_currency_symbol();

What happens if you add a currency as a parameter to get_woocommerce_currency_symbol? it gets displayed? something like echo get_woocommerce_currency_symbol("USD");

You should add to your script some error handling lines, to inform the user that he needs to have the currency set before using your extension.

Leave a Comment