Product Page

WooCommerce Stock Status Progress Bar

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:

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.

100 WooCommerce Conversion Rate Optimisation Tips

This field is for validation purposes and should be left unchanged.

Let’s collaborate!

Need to outsource WordPress development?

Join forces with UnlimitedWP for an outsourced white label web development service you can truly rely on.

First Timer Here?

Sign up to receive 20% off on your first month with us.