//* Add sold out badge on archive pages add_action( 'woocommerce_before_shop_loop_item_title', function() { global $product; if ( !$product->is_in_stock() ) { echo '<span class="soldout">Sold out</span>'; } }); //* Add sold out badge on single product pages add_action( 'woocommerce_before_single_product_summary', function() { global $product; if ( !$product->is_in_stock() ) { echo '<span class="soldout">Sold out</span>'; } });