Create a page for Logged In customers with specific item purchased?

17 1 1

I want to share some files but only to customers who have purchased from my site and are logged in. I want to create one Page like this, not my whole site, which a lot of previous threads covered.

@mfk1  in this thread seems to have made it work, but it's a liquid implementation. Putting this code in the Page's HTML editor just renders the liquid syntax as text.

To put things in pseudo code, it might look something like this.

if (viewer-is-logged-in) {
    if (viewer-has-purchased-item-X) {
        <real page contents> 
    else (view-has-not-purchased-item-X) {
        < hi this page is for customers who have purchased X > 
else (viewer-is-not-logged-in) {
   <please log in to access this page>


Is something like this possible?