开发者 | wpwham |
---|---|
更新时间 | 2024年9月27日 06:52 |
PHP版本: | 4.4 及以上 |
WordPress版本: | 6.6 |
版权: | GNU General Public License v3.0 |
版权网址: | 版权信息 |
[woocommerce_currency_switcher_drop_down_box]
- currency switcher in drop down box format.[woocommerce_currency_switcher_radio_list]
- currency switcher in radio list format.[woocommerce_currency_switcher_link_list]
- currency switcher in links list format.[woocommerce_currency_switcher_product_price_table]
- product prices preview in all currencies.[woocommerce_currency_switcher_convert_price]
- convert any price to another currency.[woocommerce_currency_switcher_current_currency_symbol]
- show current currency symbol.[woocommerce_currency_switcher_current_currency_code]
- show current currency code.If you are trying to display the converted price on a custom template for example you can use our alg_get_product_price_by_currency()
function.
e.g
add_action('woocommerce_single_product_summary', function(){ if ( ! class_exists( 'Alg_WC_Currency_Switcher' ) ) { return; } global $product; $price = get_post_meta( get_the_ID(), '_regular_price', true); $converted_price = alg_get_product_price_by_currency( $price, alg_get_current_currency_code(), $product, true ); $converted_price_formatted = wc_price( $converted_price ); echo "<h1>{$converted_price}</h1>"; echo "<h1>{$converted_price_formatted}</h1>"; });
Please make sure you are using at least one Cryptocurrency on your Currency settings. You can install All Currencies for WooCommerce plugin to enable them
If you are trying the National Bank of Georgia server option with no success, make sure that your server has the SoapClient library installed and enabled
If you want for example to turn on the rounding for all products except for Bitcoin, supposing you’ve enabled rounding and pretty price on plugin’s settings: ` add_filter( 'alg_wc_currency_switcher_correction', function ( $correction, $currency ) { if ( $currency == 'BTC' ) { $correction['rounding'] = 'no_round'; $correction['pretty_price'] = 'no'; } return $correction; }, 10, 2 ); `
If you want to set a currency just accessing an URL you can append the alg_currency variable with the currency code you want.
e.g
http://www.yoursite.com?alg_currency=USD
alg_convert_price()
function (and [woocommerce_currency_switcher_convert_price]
shortcode) - Special %cart_total%
case for price
attribute added; currency_from
attribute (empty by default) added.[woocommerce_currency_switcher_link_list]
- no_links
attribute added.[woocommerce_currency_switcher_link_list]
- %product_price%
- Checking for single product page disabled.alg_wc_currency_switcher_country_flag_image_url
filter added.alg_get_country_flag_code()
function added).no
now.alg_get_currency_exchange_rates_url_response()
function added.alg-switcher-exchange-rates-functions.php
file.uninstall.php
added.select
settings type fixed.change_shipping_price_by_currency()
- Taxes.[woocommerce_currency_switcher_current_currency_symbol]
and [woocommerce_currency_switcher_current_currency_code]
shortcodes added.format_price
attribute (defaults to yes
) added to alg_convert_price()
function (and [woocommerce_currency_switcher_convert_price]
shortcode).alg_get_product_price_by_currency()
- Code refactoring.[woocommerce_currency_switcher_convert_price]
shortcode added.alg_get_product_display_price()
.wc_get_formatted_variation()
.alg_get_product_price_html_by_currency()
- variable and grouped products fixed.alg_get_exchange_rate_yahoo()
- cURL prioritized over allow_url_fopen
(file_get_contents()
).%currency_symbol%
value added.%product_price%
value added.[woocommerce_currency_switcher_product_price_table]
shortcode added.alg_get_exchange_rate_yahoo()
- cURL fallback added for Yahoo server rates (in case allow_url_fopen
is disabled).alg_get_exchange_rate_yahoo()
- Time limit (set_time_limit()
) increased to 10 seconds.no
in add_option
.load_plugin_textdomain
moved to constructor.get_woocommerce_currency()
replaced with get_option( 'woocommerce_currency' )
.custom_number
replaced with alg_custom_number
- this fixes the issue with "Total Currencies" field duplicating.