6

Here's the situation: I have a site (not my build so I'm still learning it's process) that needs to check if a user has a successful purchase, and if so, display some content. Currently they're using submitted_order_info to check if authorized, but that only works if the order is still in session. In the event it no longer is, that tag doesn't do any good. What tag / check would you use in this case?

2
  • Are you wanting to check if the user has purchased a particular item or just an order in general? Dec 23, 2012 at 2:14
  • Store only has a single item, so an order in general. Dec 23, 2012 at 2:16

1 Answer 1

7

If your customers are required to have an account when you checkout I usually just check to see if the user has an entry in the orders channel. So I am going to assume that you have named your channel "orders" I would have something along the lines of:

{exp:channel:entries channel="orders" author_id="CURRENT_USER" status="paid|open" disable="pagination|categories|category_fields"}
<h1>You have purchased something from us!</h1>
{if no_results}
 <h2>You should probably go buy something now!</h2>
{/if}
{/exp:channel:entries}
2
  • Added a status check to make sure failed orders didn't make this work, but otherwise a perfect solution. Dec 23, 2012 at 2:47
  • That is a good point. I will edit my answer. Dec 23, 2012 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.