Support

Home Forums Event Espresso Premium how to clean up old abandoned carts

how to clean up old abandoned carts

Posted: March 28, 2022 at 12:57 pm

Viewing 3 reply threads


careertraining

March 28, 2022 at 12:57 pm

After a previous issue where the Squareonsite gateway kept needing to be reconnected, I created a monitoring script to verify that the gateway issue hadn’t happened.
The script simply navigates to the checkout form and leaves. But this creates an abandoned cart each time.
I was surprised to find that these don’t expire. Should they? Is there a setting to clean out abandoned carts automatically?

I thought about creating a wpcli cron script to do this, but espresso_registrations doesn’t appear to be visible to wpcli as a CPT. Why not?

What would you do?


Tony

  • Support Staff

March 30, 2022 at 5:23 am

Hi there,

Have you had any more issues with the Square payment method needing to be reconnected since updating to the latest version?

The script simply navigates to the checkout form and leaves. But this creates an abandoned cart each time. I was surprised to find that these don’t expire. Should they?

Does the script submit details for the attendee information step at all?

Once a registration makes it past the attendee information step, Event Espresso will not remove it.

Is there a setting to clean out abandoned carts automatically?

No, not currently.

We do have a cleanup script running on WP_CRON to remove ‘junk’ transactions (and their related registrations) which runs once an hour. However, EE will only consider a transaction to be junk if it has a status of failed, which will only be the case if the the attendee information step was not completed.

I thought about creating a wpcli cron script to do this, but espresso_registrations doesn’t appear to be visible to wpcli as a CPT. Why not?

Whilst I can check into this, I don’t recommend you do this yourself manually, if you are set on doing so, take a look at how EE_Cron_Tasks.core.php::clean_out_junk_transactions deletes these.


careertraining

March 31, 2022 at 1:00 pm

I haven’t needed to reconnect the Square gateway since the plugin update. Still, I want to be notified if any issues arise in checkout.

Yes, the script submits a page of attendee contact/address info. Perhaps there’s a way to set a transaction as Junk when the contact info matches test values?


Tony

  • Support Staff

April 1, 2022 at 3:58 am

You could, but you’ll be muddying what EE considers junk transactions there so the additional queries used to clear related data ma not work.

We have a filter around the query args passed in that function:

FHEE__EEM_Transaction__delete_junk_transactions__initial_query_args

So you can change the query using that, we some details on how to pass additional query params HERE.

Thats within EEM_Transaction.model.php::delete_junk_transactions()

Viewing 3 reply threads

The support post ‘how to clean up old abandoned carts’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso