Disable a button in dynamic pages

Hi - I have a set of dynamic pages and I need to disable a button depending on whether there is data in the linked field. The button links to an external checkout, so I remove the checkout link when the item is sold out, and need the button to disable when I have removed the link.

How can I do this please? I am a beginner with coding so simple terms would be appreciated! Thank you