Jump to content

Delete al orders & customers


HenSor

Recommended Posts

Or you can save this PHP script in the root of the eshop and run it. He does everything quickly and without problems. 🙂

If you save it with the name deleteordersandcustomers.php,

For example, you call the script address in the browser: https://my-shop.com/deleteordersandcustomers.php

After cleaning tables, don't forget to delete this script 😄

 

<?php
include('./config/config.inc.php');

$tables = array(
'address',
'cart ',
'cart_cart_rule',
'cart_product',
'cart_rule',
'cart_rule_carrier',
'cart_rule_combination',
'cart_rule_country',
'cart_rule_group',
'cart_rule_lang',
'cart_rule_product_rule',
'cart_rule_product_rule_group',
'cart_rule_product_rule_value',
'cart_rule_shop',
'connections',
'connections_page',
'connections_source',
'customer',
'customer_group',
'customer_message',
'customer_message_sync_imap',
'customer_session',
'customer_thread',
'customization',
'customized_data',
'guest',
'log',
'mail',
'message',
'message_readed',
'orders',
'order_carrier',
'order_cart_rule',
'order_detail',
'order_detail_tax',
'order_history',
'order_invoice',
'order_invoice_payment',
'order_invoice_tax',
'order_message',
'order_message_lang',
'order_payment',
'order_return',
'order_return_detail',
'order_return_state',
'order_return_state_lang',
'order_slip',
'order_slip_detail'
);

foreach ($tables as $table) {
    if (Db::getInstance()->execute('TRUNCATE TABLE '._DB_PREFIX_.$table)){
        echo 'table '._DB_PREFIX_.$table.' is is cleaned'.'<br>';
    }
}

 

  • Thanks 1
Link to comment
Share on other sites

On 12/14/2022 at 2:20 PM, HenSor said:

Version:  1.7.8.7

PHP-version: 7.2.34

 

Hello everybody.

I have sold my business, and therefor the Prestashop shall be resetted about customers, and orders.

Ca anybody help Me how to do that.

 

Vh.  Henrik

orders deletion is quite a delicate process, you can try using the free version of store manager for this task https://www.prestashopmanager.com/useful-articles/prestashop-orders/how-to-delete-orders-in-prestashop/

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...