Time limit on cart items

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.

I’m getting there slowly…

After spending too much time trying to make the true/false properties send to Integromat I created a new property: Paid?0=false,1=true and just marked the fields either 0 or 1. I had also been watching an old tutorial by Patick Ford on Youtube about using a workaround for a webhook before customer actions were released - there’s obviously a much better way now!

I’m now at the stage where I think I’m sending the correct data from Adalo to Integromat. My scenario runs up until the data passes successfully through the ‘Paid?’ filter and into the ‘Update Record’ Adalo module - where it fails with " RuntimeError [400] Request failed with status code 500". I’ve added the screenshots below - can anyone help?

Bump - still having the same issue with Integromat

Also experiencing 500 codes when trying to Update a Record in Integromat, is anyone also still experiencing this issue?

Have you found a solution yet? It’s a shame that we can’t get an answer to this as it doesn’t look good for forum threads to be ignored :confused:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.