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.
Was This Tutorial Helpful?