How to automatically empty a customer's cart after a set time in Shopify?

Topic summary

Goal: prevent customers from checking out with an outdated, previously selected delivery date (orders must be 48+ hours out). Current cart countdown doesn’t clear items once a customer has reached checkout, allowing late checkout with the old date.

Key points:

  • No built-in Shopify setting was identified to auto-empty carts after a set time.
  • Storefront options: third-party apps can clear carts in the cart stage (e.g., Urgency Cart Countdown Timer), but they typically can’t affect the cart once the customer is in checkout.
  • Code-based approach: use Shopify’s Cart AJAX API (clear.js) to programmatically empty the cart when a browser-stored timer ends. This requires theme code edits or developer help.
  • Limitation: scripts (and thus cart clearing) won’t run in the checkout flow, so the workaround only applies before checkout.

Status/outcome:

  • Practical path is to implement a storefront timer-triggered cart clear via AJAX or use a compatible app, acknowledging checkout-stage limitations.
  • No final resolution; the thread remains open with the core constraint (no clearing after entering checkout) still in place.
Summarized with AI on December 30. AI used: gpt-5.

Hello, we sell made-to-order products that can be ordered for a specific date. The problem we have is that some people add an item to the cart, choose a delivery date (orders can’t be placed within 48 hours), but then do not place the order for whatever reason. Instead, they come back a few days later to place the order with the original date still stored in the browser/order. Consequently, they’re able to place orders within 48 hours, sometimes even for the same day, which is impossible for us as we make everything to order.

We have a countdown timer on the cart, but if they’ve already proceeded to the checkout, the countdown timer won’t empty the cart. Therefore, they can still place the order at a later date, with their original and (ideally) unavailable date.

Is there a setting in Shopify that will just wipe the cart after a certain amount of time?

Hi Harry,

Which app are you using? There are a couple of apps that empty carts like Urgency Cart Countdown Timer (4.9 stars, 81 Reviews, Free), but I haven’t seen any that can affect the cart after a customer has made it to checkout. If you’re comfortable editing your store’s theme code, you can clear cart via Shopify’s clear.js API, or else work with a shopify developer to making some updates.

Hi @Harry30 ,

Are you using APP for countdown feature? You can clear the cart using the Shopify cart frontend API.

For this you just need the trigger point, that is end of the timer which will be stored in user browser. Whenever the time lapse a SCRIPT function will clear the user’s cart.

The only concern is this script will not run in checkout flow.

Let me know if you have any further questions or need help in implementing the same.