woocommerce_format_stock_quantity filter-hookWC 3.0.0

Format the stock quantity ready for display.

Usage

add_filter( 'woocommerce_format_stock_quantity', 'wp_kama_woocommerce_format_stock_quantity_filter', 10, 2 );

/**
 * Function for `woocommerce_format_stock_quantity` filter-hook.
 * 
 * @param int        $stock_quantity Stock quantity.
 * @param WC_Product $product        Product instance so that we can pass through the filters.
 *
 * @return int
 */
function wp_kama_woocommerce_format_stock_quantity_filter( $stock_quantity, $product ){

	// filter...
	return $stock_quantity;
}
$stock_quantity(int)
Stock quantity.
$product(WC_Product)
Product instance so that we can pass through the filters.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

wc_format_stock_quantity_for_display()
woocommerce_format_stock_quantity
woocommerce/includes/wc-formatting-functions.php 1281
return apply_filters( 'woocommerce_format_stock_quantity', $stock_quantity, $product );

Where the hook is used in WooCommerce

Usage not found.