Home > other >  Add thousand separator in Woocommerce email 'Quantity' values
Add thousand separator in Woocommerce email 'Quantity' values

Time:11-08

This is a very challenging thing I came across. I know the code should be:

$quantity = number_format($quantity, 0, '.', ',');

I have looked everywhere in the Woocommerce plugin and docs and around the internet but where to insert this code? In which hook or template file? Please help me put a thousand separator for the 'Quantity' row in the order emails template, as shown in the attached screenshot.

Thank you.

enter image description here

CodePudding user response:

I think this is what you need:

function format_quantity( $quantity ) {
    return number_format($quantity, 0, '.', ',');
}

add_filter( 'woocommerce_email_order_item_quantity', 'format_quantity', 1);
  • Related