Is there any way to access the past orders for a customer in the shopify checkout scripts?

New Member
5 0 0

Hi Shopify Experts! We are trying to limit customers from buying an item if they´ve bought it in the last 364 days.


Currently we have the situation under control by using liquid to hide the add to cart form/buttons from the product page, but as you know anyone with coding skills can easily continue to add products to the cart by manually sending the data.


We have a couple of limits in place via a line items scripts, but in this case when I try to access the Input.cart.customer.orders I see that it does not exist. Also if I do an inspect on the customer item, I see that it only has a few properties/methods. 


Is there any way to access the orders from a checkout script ?


Thanks in advance!!

Reply 1 (1)
103 8 35

I set something like this up a long way back.  Was complicated, but I did it with Flow.


- Money did not auto collect on Orders.  

- When a Purchase was made with said item, Flow Tagged the account.

- When purchase was made, it checked for the tag.  If it existed, it canceled the order.  Otherwise accepts the money (went further to also add auto cancel High risk and medium risk orders).

- Depending on other Settings, you could also have it check for tag removal based on other settings (Like If Tag Exists, and Order is after Said Date.  Remove tag).  This of course would still only trigger on another order coming in from that customer.


You could also try to call the data via API @ checkout but you would want a dev to build it into an app to hide the API Key otherwise a techie person might gain access to the same data which would be BAD.....


Alternately you could have the info send a yes  or No via Checkout properties and check vs that.  This would still only work though if its not direct to checkout which anyone in the know of shopify could do to get around it.


I would also ask your Plus Account manager.  They may have heard of someone else who did something like this and know how they did it.


Best Regards