WordPress, Genesis Framework and Storefront customization tutorials
Home ยป If product is out of stock echo something – WooCommerce product single
If product is out of stock echo something – WooCommerce product single
//Echo something if product is out of stock
add_action( 'woocommerce_share', 'add_out_of_stock_custom_message', 5 );
function add_out_of_stock_custom_message() {
global $product;
if ( ! $product->is_in_stock() ) {
echo '';
}
}
About Gabor Flamich
I'm a web developer and designer based in Budapest, Hungary. In recent years, I've documented hundreds of solutions I came across during development. This site is an archive for useful code snippets on WordPress, Genesis Framework and WooCommerce. If You have any questions related to WordPress development, get in touch!
Amine says
Thanks !!!!