If you have a maximum number of related products you can create an arbitrary amount of dropdown template variables, as in the previous example:
<a href="[~[*link1*]~]">[[GetField? &docid=`[*link1*]` &field=`pagetitle`]]</a>
<a href="[~[*link2*]~]">[[GetField? &docid=`[*link2*]` &field=`pagetitle`]]</a>
<a href="[~[*link3*]~]">[[GetField? &docid=`[*link3*]` &field=`pagetitle`]]</a>
<a href="[~[*link4*]~]">[[GetField? &docid=`[*link4*]` &field=`pagetitle`]]</a>
And then, if the user doesn’t fill all template variables for the related products, you can hide the link with PHx plugin, for example (Note: PHx is not installed by default on MODx Evolution. Download it from the extras section.):
[+phx:if=`[*link1*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link1*]` &field=`pagetitle`]]</a>`+]
[+phx:if=`[*link2*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link2*]` &field=`pagetitle`]]</a>`+]
[+phx:if=`[*link3*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link3*]` &field=`pagetitle`]]</a>`+]
[+phx:if=`[*link4*]`:is=`0`:then=``:else=`<a href="[~[*link1*]~]">[[GetField? &docid=`[*link4*]` &field=`pagetitle`]]</a>`+]
0 should be set as default value when [*link1*] Template Variable is empty, so that PHx will not output anything in that case.
If that doesn’t work, I guess you could make a checkbox template variables list