Delete and reimport an Amazon order
Delete and reimport an Amazon order in PrestaShop
This tutorial explains how to remove an Amazon order from PrestaShop so the module can import it again.
ps_ with your shop’s table prefix if it is different.What you need before starting
From the order you want to remove, note:
- PrestaShop order ID →
id_order - Amazon order ID →
mp_order_id - Order reference →
reference(from theorderstable) - Product lines from
order_detail: id_productid_product_attributeproduct_quantityid_shop
You need the product lines to restock after the order is deleted.
Step 1 – Delete the PrestaShop order in the database
Delete related rows first, then the order itself.
-- Tax lines linked to the order details
DELETE odt FROM ps_order_detail_tax odt
INNER JOIN ps_order_detail od ON od.id_order_detail = odt.id_order_detail
WHERE od.id_order = {ID_ORDER};
DELETE FROM ps_order_detail WHERE id_order = {ID_ORDER};
DELETE FROM ps_order_history WHERE id_order = {ID_ORDER};
DELETE FROM ps_order_carrier WHERE id_order = {ID_ORDER};
DELETE FROM ps_order_cart_rule WHERE id_order = {ID_ORDER};
-- Invoices (if any)
DELETE oip FROM ps_order_invoice_payment oip
INNER JOIN ps_order_invoice oi ON oi.id_order_invoice = oip.id_order_invoice
WHERE oi.id_order = {ID_ORDER};
DELETE oit FROM ps_order_invoice_tax oit
INNER JOIN ps_order_invoice oi ON oi.id_order_invoice = oit.id_order_invoice
WHERE oi.id_order = {ID_ORDER};
DELETE FROM ps_order_invoice WHERE id_order = {ID_ORDER};
-- Payments (linked by order reference, not by id_order)
DELETE FROM ps_order_payment WHERE order_reference = '{ORDER_REFERENCE}';
DELETE FROM ps_orders WHERE id_order = {ID_ORDER};
If this order also has returns, credit slips, or messages, delete those related rows as well.
Step 2 – Restock the products
After the order rows are deleted, add the stock back using the quantities you noted from order_detail (product_quantity for each product / combination / shop).
Do this after deleting the order, not before.
Step 3 – Remove the module marketplace data
Delete all rows for this Amazon order from the module tables:
DELETE FROM ps_marketplace_order_items WHERE mp_order_id = '{MP_ORDER_ID}';
DELETE FROM ps_marketplace_order_address WHERE mp_order_id = '{MP_ORDER_ID}';
DELETE FROM ps_marketplace_orders WHERE mp_order_id = '{MP_ORDER_ID}';
mp_order_id. The marketplace_orders table can be shared with other marketplace modules.On some older shops, if the column mp_order_id still exists in ps_orders, make sure no leftover value remains for this order.
Step 4 – Reimport the order
Run the Amazon order import again (Orders tab or cron), for the correct marketplace and date range.
The module should create a new PrestaShop order for the same Amazon order ID.
Summary
- Note
id_order,mp_order_id,reference, and product quantities - Delete the PrestaShop order and related order tables in the database
- Restock the products
- Delete rows from
marketplace_order_items,marketplace_order_address, andmarketplace_orders - Run order import again
Updated on: 17/11/2026
Thank you!
