On my Woocommerce website, I need to display Total Order Amount
in words, which will be shown on Checkout Page, Cheque Payment & on Invoice.
Example: 1590.00 (One thousand five hundred & ninety only)
How can we achieve this? TIA
On my Woocommerce website, I need to display Total Order Amount
in words, which will be shown on Checkout Page, Cheque Payment & on Invoice.
Example: 1590.00 (One thousand five hundred & ninety only)
How can we achieve this? TIA
You can try number formatter class as mentioned in these threads a and b
Use the filter "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' );
You can also try the other hooks like woocommerce_get_formatted_order_total