PDF Template, hide/show part of template under conditions

Good morning,
In PDF template, is it possible show/hide part of template under conditions?? In my case, I would like show a text only if the field has a particular value or is not null. for example:

and discount for your order is: $mymodule_discount

I would like to show this row only if $mymodule_discount is set.

Can someone help me?
Thank you
B.

That option does not exist.

A workaround is to use a custom field with the entire sentence, and make it an empty string when the discount is not set. Then you can use that custom field on the template (I am not sure you can use custom fields there, but I think you can).

Or you have my Power Replacer add-on which does just that sort of thing and a lot more.

You would need to customise the PDF generation code. Original file is located at :

/modules/AOS_PDF_Templates/generatePdf.php

Thank you for your answer, but I can’t implement your solution, cause I need to made this for around 30 fields and more, and I need to put in a list, so I the first 20 elements are empty, I’ll have 20 empty rows and the number of fields in the module grow and they are difficult to manage.