gpt4 book ai didi

wordpress - Woocommerce:如何在 Words 中显示 ‘Order Total’ 金额

转载 作者:行者123 更新时间:2023-12-02 01:21:25 25 4
gpt4 key购买 nike

在我的 Woocommerce 网站上,我需要用文字显示Total Order Amount,这将显示在结帐页面、支票付款和发票上。

示例:1590.00(仅一千五百九十)

我们怎样才能做到这一点?时间差

最佳答案

您可以尝试这些线程中提到的数字格式化程序类 ab

使用过滤器“woocommerce_cart_totals_order_total_html”。

function custom_woocommerce_order_amount_total( $order_total ) { 
$number_total = WC()->cart->get_total();
// number formatting goes here;
// using number formatter class
$f = new NumberFormatter("en", NumberFormatter::SPELLOUT);
$total_in_words = $f->format($number_total); // Total in words
$order_total = $total_in_words;
return $order_total;
};
add_filter( 'woocommerce_cart_totals_order_total_html', 'custom_woocommerce_order_amount_total' );

您还可以尝试其他 Hook ,例如 woocommerce_get_formatted_order_total

关于wordpress - Woocommerce:如何在 Words 中显示 ‘Order Total’ 金额,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40029445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com