Delete Order History after one day automaticly

WPPizza – A Restaurant Plugin for WordPress Support General Support Delete Order History after one day automaticly

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #44321
    mia3
    Participant

    Hall Olli,

    is it possible to delete or clear orderhistory atomaticly after one day. i have edit a adminpage and the admins only have a look in frontend for orders. Especialy i do not want the possibility to enter in backend for admins. so my wish is to track the hole summery and the orders have to clear automaticliy after 24 hours.

    hope you can help me very quick.

    thanks

    #44328
    Olly
    Admin & Mod

    You’ll have to write some sort of cronjob (or WP Cron)
    you could base this on the getting and deleting orders functions here
    https://docs.wp-pizza.com/developers/?section=function-wppizza_get_orders
    or of course use WP_Query itself or even your own sql statement

    essentially you need to query the [yourprefix]_wppizza_orders table by orde_date and delete the entries as you require
    be aware that every order id in that table might also have associated metadata in [yourprefix]_wppizza_orders_meta
    so you will want to get those too and delete the rows in that table as well or you will end up with orphaned entries in the meta table.

    alternatively – if you are really quite sure you want to delete all entries, simply truncate those 2 tables at whatever time is appropriate

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Delete Order History after one day automaticly’ is closed to new replies.