Sometimes products go out of stock. It happens. If you are looking to modify the error message WooCommerce shows by default when a product is out of stock, you can use the snippet below. Just paste it in your functions.php and modify the text as you please.

<?php /** * * WordPress and WooCommerce Resources * Change "You cannot add product to the cart because the product is out of stock" message in WooCommerce */ add_filter('woocommerce_cart_product_out_of_stock_message', 'wpharvest_out_of_stock_text'); function wpharvest_out_of_stock_text($message, $product_data){ $message = sprintf( __( 'We are sorry, &quot;%s&quot; is currently out of stock. Please check again soon.', 'woocommerce' ), $product_data->get_name() ); return $message; }
Code language: HTML, XML (xml)

Hope this snippet helped you. If it stops working for you or are having any issue, please leave a comment below.

Recover lost customers

If you are losing customers over out of stock products, you should look into creating an automatic reminder that brings them back.

The best solution by far is sending a notification to their Facebook Messenger inbox. It has a much higher open and click rate than standard email notifications, and can bring back up to 8x more customers.

Messenger notifications for WooCommerce plugin allows you to send back in stock reminders to your customers, as well as send your order receipts. This also opens up the doors for many retargeting opportunities.

WooCommerce to Messenger back in stock reminder
WooCommerce to Messenger receipt notification

Learn more about Messenger Notifications for WooCommerce

Published by Dragos Micu


Leave a Reply

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