【问题标题】:How to display the price in 2 currencies in Woocommerce?如何在 Woocommerce 中以 2 种货币显示价格?
【发布时间】:2017-08-24 15:32:09
【问题描述】:

我已经安装了 WPML,以便在我的 Woocommerce 产品页面上添加货币选择器,一切都很好!

但我的问题是:我可以用 2 种不同的货币显示我的价格吗? For example, when the $ CAD is selected, the price would show like this 0,00 $ (0,00 €) but if the currency in the selector is €, the price would show like this 0,00 € (0,00 $)

有什么想法吗?

谢谢!

【问题讨论】:

    标签: php wordpress woocommerce wpml


    【解决方案1】:

    你可以使用过滤器woocommerce_get_price_html,

      add_filter('woocommerce_get_price_html', 'my_price_html, 99, 2);
      function my_price_html( $price, $product ){
             return 'Was:' . str_replace( '<ins>', ' Now:<ins>', $price );
      }.    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-01
      • 1970-01-01
      • 2019-09-24
      • 1970-01-01
      • 2015-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多