WooCommerce Stock Status Progress Bar


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

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!<br><progress max="100" value="'.$stock_quantity.'"></progress>'; // 100 being the fill level of the progress bar (the left most value)

Snippet Benefits

  • Introduce Fear Of Missing Out (FOMO) by showing how many products are available as well as sold.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers