WooCommerce: Stock Quantity Suffix e.g. “sq. in.”, “Kg”, “boxes”, etc.
VIA BUSINESS BLOOMERS

WooCommerce: Stock Quantity Suffix e.g. “sq. in.”, “Kg”, “boxes”, etc.

Each WooCommerce business is different, which means customization is required to adapt the store to unique specifications.

A clear example is the stock quantity. Not all stores can display the standard notice “11 in stock”. The display could change to “11 Kg in stock” if stock is based on weight. Or maybe “11 boxes in stock” or “11 pairs in stock” in case the package description is useful UX-wise. Also, “11 m3 in stock” if the business sells volumes.

Either way, this is a nice trick to display a “stock quantity suffix” in your WooCommerce Single Product Page. Enjoy!

In this example, I’ve added “m2” suffix to the stock quantity on the WooCommerce Single Product Page. Easy peasy with the PHP snippet below!

PHP Snippet: Stock Quantity Suffix @ WooCommerce Single Product Page

/** * @snippet       Stock Quantity Suffix @ WooCommerce Single Product * @how-to        Get CustomizeWoo.com FREE * @author        Rodolfo Melogli * @compatible    WooCommerce 5 * @donate $9     https://businessbloomer.com/bloomer-armada/ */add_filter( 'woocommerce_format_stock_quantity', 'bbloomer_stock_quantity_suffix', 9999, 2 );function bbloomer_stock_quantity_suffix( $stock_quantity, $product ) {    $stock_quantity .= ' m<sup>2</sup>'; // CONCATENATE " m2"    return $stock_quantity;}

WooCommerce: Stock Quantity Suffix e.g. “sq. in.”, “Kg”, “boxes”, etc. .