Snippets: Change Price for WooCommerce Out of Stock Products

function myprefix_edit_woo_price( $price, $product ) {
	if ( ! $product->is_in_stock() ) {
		$price = 'Sold';
	}
	return $price;
}

add_filter( 'woocommerce_variable_sale_price_html', 'myprefix_edit_woo_price', 10, 2);
add_filter( 'woocommerce_variable_price_html', 'myprefix_edit_woo_price', 10, 2);
add_filter( 'woocommerce_get_price_html', 'myprefix_edit_woo_price', 10, 2);
All PHP snippets should be added via a child theme's functions.php file.