Time limit on cart items

Hi,

Can Adalo set a time limit on a customers cart (basket) items?

For example, if my app sells event tickets with a limited capacity I want to avoid customers holding available tickets in their cart (or basket). I would like to advise them they have 5 minutes to complete the purchase with their secured spaces on the event before those spaces are put back into the availability pool.

Thanks,
Ash

You may want to start a countdown timer on the Cart page once user selects the tickets, and inform the user that the tickets are available for next 5 mins (for example).

When the 5 mins timer is complete, check whether the temp cart is still active, if it is active, trigger action to remove items from the cart and redirect user to start again.

If the user already checked out when the timer ends, do nothing.

1 Like

Thanks a lot Bhanu!!

1 Like

@bhanu - Do you have any idea on how to empty the cart / delete the order if a user simply force closes the app?

Hi Ash. You must remember that the solution Bhanu offered will only work if the user stays on the same screen. The countdown timer does not carry over to another screen. To achieve this you must set actions on screen load that calculate the current time compared to when the order was started and then you can delete the items if a certain amount of time has elapsed.

ā€œDo you have any idea on how to empty the cart / delete the order if a user simply force closes the app?ā€ Unfortunately at the moment there is no way to empty the cart when a person force closes the app. For this you would have to use the same process as mentioned above.

Thanks for the reply.

Will either of the solutions continue to count down if a user closes the app? For example, if a user force closes the app does the 5 minute timer continue to count down and when it reaches 0 delete the cart items?

Iā€™ve just been looking at the screen load options but I can only work it how it will calculate if users have exceeded 5 minutes when they first load the page. How would I have the action refresh every 30 seconds or so?

Cheers,
Ash

To be honest I have never tested the countdown timer when closing the app but I have a strong feeling the answer is no. It may continue counting when the app is opened again but this defeats the object of what you are trying to achieve.

The other solution will not work until the user opens the app and then visits another page as it only works with an action set on screen load or button click. You can set an action to run every 30 seconds by using the countdown timer but this would erase everything on the screen so would not be a good experience for a user.

Cheers
Craig

Iā€™ve just tested the timer to see if it does empty the cart / delete the order after expiring if a user closes the app. Sadly it doesnā€™t. As Iā€™ve understood it then there is realistically no way in Adalo to either:

  • Set a time limit from when a user adds a product to their cart for it to be deleted if the purchase is not completed (it seems normal that they will move from an add items to a payment screen)

  • Empty the cart / delete the order if a user force quits the app

So how are people who run eCommerce sites replenishing their stock count from incomplete orders?

Thanks,
Ash

@Ash1 If you want to clear if the user closes the app or goes away from the screen, one way is to use integromat and trigger the process of clearing the cart.

When the user comes to the cart page, you send a webhook to integromat to start timer and when the timer ends you call the http module to check the data in the cart, if it exists, go ahead and clear the cart. This works even if the app is closed or user is in another screen

Thanks for the info @bhanu!

Iā€™ve been trying to get my head around Integromat today and I think Iā€™ve created the 5 minute timer correctly using the ā€˜sleepā€™ fuction. I then wasnā€™t sure what the Record ID should be so Iā€™ve created a random Record ID property in ā€˜Order Itemsā€™ and used that. Is that the correct thing to do?

Iā€™m a little unsure about exactly how to set up Integromat and if my database needs updating. Hereā€™s what Iā€™ve got at the moment:

Database Structure
Timeslot - Timeslots are created with a specific event, date, time & maximum capacity
Order
Order Items
Products

Purchase Flow

  • User creates ā€˜Orderā€™ by clicking on an available ā€˜Timeslotā€™
  • User creates ā€˜Order Itemā€™ belonging to current order
  • User selects quantity of ā€˜Order Itemā€™ (this reduces the remaining capacity field in the ā€˜Timeslotsā€™ collection by the selected quantity)
  • User pays on the next screen and ā€˜Orderā€™ is updated to show ā€˜Paid?ā€™ as Yes

Once a user has created an ā€˜Order Itemā€™ they have the option to edit the quantity or delete it all together. This also updates the ā€˜Timeslotsā€™ remaining capacity field to add back on the delete amount.

Currently, I have a ā€˜Paid?ā€™ property on the ā€˜Ordersā€™ collection but not on the ā€˜Order Itemā€™ collection. Do I need to add this so the http module checks whether that value is true/false and Integromat triggers an action accordingly - like below?

  • Check if ā€˜Order Itemā€™ property ā€˜Paid?ā€™ is true - if true do nothing

If it is not true:

  • Update ā€˜Timeslot - remaining capacityā€™ to Timeslot - remaining capacity + current order item quantity
  • Delete ā€˜Current Order Itemsā€™

Based on the above how should the http request look? This is the Integromat scenario Iā€™ve got at the moment:

Thanks again,
Ash

@Ash1 just looking at this. Let me think and will reply by tomorrow. Thanks

1 Like

Hi @Ash1

Incomplete orders would not update stock.

If you have a date time property at the left behind cart, you can check them before going to the order screen and use interim screen to delete them using countdown, if the count is 0 for the filtered of that date time property you can link back and show cleared cart.

Thanks for the reply @Yongki

Iā€™m not sure if this is the best solution to the problem that I have or for eCommerce sites with limited stock.

In the app that Iā€™m building there are only a certain amount of tickets available and potentially lots of users trying to book them. I need the app to secure the tickets for the logged in user once theyā€™ve added them to the cart. However, if that user doesnā€™t complete the purchase I then need those tickets to go back into the available market.

I feel like this is the correct purchase flow for most eCommerce type apps where the user should be given a certain amount of time to secure their purchase. Perhaps this isnā€™t a problem if you have a large amount of stock of the same item but in the case of tickets, limited edition sales etc. it will be.

Hi @Ash1 ,

I understand your situation.

To have actions in Adalo, we need trigger which can be interactive such as clicking button by user or countdown, so if you canā€™t get those triggers, you may need other integration tools.

But just one more idea, can you put countdown at home screen and update the number in seconds with magic text that can save and resume between screens, so each time you link to another screen, you save this number, then resume again whenever user returns to home screen.

If the user never return to home screen, then you need to put countdown to every screen, so it will still run everywhere.

When finished, link to interim screen that will do clearing cart.

@Ash1

for the http module, you should use the recordID received in webhook trigger when a new order (unpaid) is created.

After you get the record, you need to add a filter module and check if the order is PAID, if not trigger a delete order + a for loop to go through the order items with the current unpaid order and delete those order items from the DB. for each delete, go back to the stock and update the QTY to QTY+1

If the order is PAID when checking with the filter, do nothing.

What do you think?

Thanks again @bhanu

Iā€™m setting up the HTTP module at the moment but Iā€™ve ran into another issue. I canā€™t get the webhook data sent to Adalo to include the true / false field for ā€˜Paid?ā€™ which is stopping me using it as a filter.

Anyone got any ideas? Hereā€™s a screenshot of where Iā€™m at the moment:

Also - Does anyone see a potential issue with deleting the order and order items?

Iā€™m wondering what would happen if a user clicks on the payment button within the time limit, but it goes over 5 minutes during their payment. I assume their order will still be deleted but they might be able to complete payment still and end up with an order that doesn

@Ash1 I think you can modify the webhook data triggered by Adalo to receive the True/False field information.

I would probably do this a little differently, instead of targeting a delete for every order, Iā€™d just mark the OrderID invalid after 5mins.

And then do a batch cleanup everyday once for all the invalid orders.

For the front end check, you could probably approach in a different way too. Hereā€™s what I think will work.

  1. When the user comes to checkout page, take a timestamp and store it in a separate field
  2. When the user clicks ā€œProceed to Payā€ (immediately or later); check the current time - timestamp of the checkout page
  3. If the time difference is more than 5 mins, bring up a modal or error screen and mark the order invalid
  4. Redirect user to start fresh when #3 happens
  5. Do not subtract order items from inventory unless the checkout was successful (this can help your inventory tracking clearer)

At #3 - if youā€™re worried about double-selling due to not tracking of inventory - you can add a check to see if the stock position is still valid to proceed with checkout, to avoid selling more than you have.

Create a batch run EOD to check all invalid orders and clear them to save the space in your db.

Let me know what you think

Thanks again for another very detailed reply @bhanu!

I really like the idea of making the orders invalid rather than deleting individually and then doing a batch clear up - will definitely implement this! I also think your front end flow is cleaner than what I had in mind and will probably reduce any issues with constantly updating stock count (especially if a lot of users are purchasing the same product at the same time).

Iā€™m still having an issue sending the ā€˜Paid?ā€™ true/false field to Integromat though as itā€™s just not appearing - see below:

Hopefully Iā€™m just missing the obvious and itā€™s not the same issue as described in Webview Link Data - Magic Text

Thanks,
Ash

Iā€™ve been playing around with the order flow today and Iā€™ve come to another issue (sorry!..).

If I use your suggestion above and do not remove the stock count until payment is made how will I ensure there is enough stock before a user pays?

All I can see on the stripe payment component is ā€˜after successful paymentā€™ which doesnā€™t give me the option to check if the quantity the user has selected is still available and therefore could lead to a payment being made where I cannot supply the product.