This snippet inserts a progress bar on the product page to let customers know how many units you have in stock. The visual representation conveys more scarcity because they will be able to see not only how many units you have in stock but also how many have been sold. This Fear Of Missing Out (FOMO) tactic indices urgency making people more likely to buy.
/**
* Snippet Name: WooCommerce Stock Status Progress Bar
* Snippet Author: ecommercehints.com
*/
add_action( 'woocommerce_before_add_to_cart_form', 'ecommercehints_stock_status_progress_bar', 10, 0 );
function ecommercehints_stock_status_progress_bar() {
global $product;
if (!$product->managing_stock()) return; // Don't show the progress bar if stock isn't being managed
$stock_quantity = $product->get_stock_quantity();
echo 'Only ' . $stock_quantity . ' tickets remaining!
'; // 100 being the fill level of the progress bar (the left most value)
}