mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-30 11:42:22 +08:00
https://stackoverflow.com/questions/63856371/add-thousand-separator-to-product-quantity-in-woocommerce/63881751
14 lines
554 B
Text
14 lines
554 B
Text
function filter_woocommerce_checkout_cart_item_quantity( $item_qty, $cart_item, $cart_item_key ) {
|
|
// Get quantity
|
|
$cart_item_quantity = $cart_item['quantity'];
|
|
|
|
// Format
|
|
$cart_item_quantity = number_format($cart_item_quantity, 0, ',', ' ');
|
|
|
|
// Output
|
|
$item_qty = '<strong class="product-quantity">' . sprintf( '× %s', $cart_item_quantity ) . '</strong>';
|
|
|
|
// Return
|
|
return $item_qty;
|
|
}
|
|
add_filter( 'woocommerce_checkout_cart_item_quantity', 'filter_woocommerce_checkout_cart_item_quantity', 10, 3 );
|