Hello.
If you want to change it directly in the TPL, it is not a problem to add the condition.
./themes/your_theme/templates/catalog/_partials/product-flags.tpl
Sample for category id 3:
{block name='product_flags'} <ul class="product-flags js-product-flags"> {if $category.id == '3'} <li class="product-flag new">{l s='discountinued' d='Shop.Theme.Catalog'}</li> {/if} {foreach from=$product.flags item=flag} <li class="product-flag {$flag.type}">{$flag.label}</li> {/foreach} </ul> {/block}
result:
If you also want to do it with a module, that's no problem either.