Raging Vids
Raging Vids

Reputation: 121

Add thousand separator in Woocommerce email 'Quantity' values

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

Upvotes: 0

Views: 164

Answers (1)

Solonl
Solonl

Reputation: 2502

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);

Upvotes: 3

Related Questions