WordPress Tutorials

If WooCommerce Product Out Of Stock, Show Widget

This code enables you to display a widget area if your single product is out of stock. You can display the widget in any WooCommerce single product page hook position.

In this example, we’ll use the the woocommerce_before_single_product hook.

Here’s the code you can add copy ( without the opening PHP tag ) to your child themes functions.php file.

Note : You will need to swap out both instances of the text-domain with the text-domain for your theme. You can find the text domain in your style.css file header.

In this example, the text-domain should be changed to genesis-sample. However, the PHP code will work in any WordPress theme and is NOT coded with Genesis widget functions.

Download Folder

Leave a Reply

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