PrestaShop - Get Orders
Description
Section titled “Description”This module allows querying orders from your PrestaShop store, either a specific order by ID or a filtered list by status, customer, dates, and other criteria.
Configuration
Section titled “Configuration”Credentials
Section titled “Credentials”Uses the same credentials as other PrestaShop modules. Make sure the API Key has read permissions on “orders”.
Required Permissions in PrestaShop
Section titled “Required Permissions in PrestaShop”orders- GET (read)order_states- GET (optional, to filter by status)
Parameters
Section titled “Parameters”| Field | Type | Required | Description |
|---|---|---|---|
credentials_id | string | Yes | PrestaShop credentials ID |
order_id | number | No | Specific order ID |
order_reference | string | No | Order reference (e.g.: ABCD1234) |
order_state | number | No | Order state ID |
customer_id | number | No | Customer ID |
date_from | string | No | Date from (YYYY-MM-DD) |
date_to | string | No | Date to (YYYY-MM-DD) |
limit | number | No | Result limit (default: 50) |
sort_by | string | No | Sort field (default: id) |
sort_order | string | No | Order: ASC or DESC (default: DESC) |
display_fields | string | No | Fields to show: full, basic, or comma-separated list |
Common PrestaShop Order States
Section titled “Common PrestaShop Order States”| ID | State |
|---|---|
| 1 | Awaiting check payment |
| 2 | Payment accepted |
| 3 | Preparation in progress |
| 4 | Shipped |
| 5 | Delivered |
| 6 | Cancelled |
| 7 | Refunded |
| 8 | Payment error |
| 9 | Awaiting PayPal payment |
| 10 | Remote payment accepted |
Note: IDs may vary depending on your store configuration.
Output
Section titled “Output”Order List
Section titled “Order List”{ "success": true, "orders": [ { "id": "123", "reference": "ABCD1234", "id_customer": "45", "current_state": "4", "total_paid": "89.99", "date_add": "2024-01-15 10:30:00", "...": "other fields" } ], "total": 25, "filters_applied": { "order_state": 4, "limit": 50, "sort": "id_DESC" }}Specific Order
Section titled “Specific Order”{ "success": true, "order": { "id": "123", "reference": "ABCD1234", "id_customer": "45", "current_state": "4", "total_paid": "89.99", "total_products": "79.99", "total_shipping": "10.00", "payment": "PayPal", "date_add": "2024-01-15 10:30:00", "associations": { "order_rows": [...] } }, "total": 1}Usage Example
Section titled “Usage Example”Get a specific order
Section titled “Get a specific order”{ "credentials_id": "presta_tienda", "order_id": 123}Search by reference
Section titled “Search by reference”{ "credentials_id": "presta_tienda", "order_reference": "ABCD1234"}Orders pending shipment
Section titled “Orders pending shipment”{ "credentials_id": "presta_tienda", "order_state": 3, "limit": 100, "sort_by": "date_add", "sort_order": "ASC"}Customer orders
Section titled “Customer orders”{ "credentials_id": "presta_tienda", "customer_id": 456, "limit": 20}Today’s orders
Section titled “Today’s orders”{ "credentials_id": "presta_tienda", "date_from": "2024-01-15", "date_to": "2024-01-15", "display_fields": "basic"}Last 10 shipped orders
Section titled “Last 10 shipped orders”{ "credentials_id": "presta_tienda", "order_state": 4, "limit": 10, "sort_by": "date_add", "sort_order": "DESC"}Last month’s orders
Section titled “Last month’s orders”{ "credentials_id": "presta_tienda", "date_from": "2024-01-01", "date_to": "2024-01-31", "display_fields": "id,reference,total_paid,current_state,date_add"}Example Workflows
Section titled “Example Workflows”Workflow 1: Daily Order Export
Section titled “Workflow 1: Daily Order Export”[Schedule (daily)] -> [PrestaGetOrders] -> [Transform] -> [Google Sheets] -> [Slack]Node configuration:
{ "credentials_id": "presta_tienda", "date_from": "{{moment().subtract(1,'day').format('YYYY-MM-DD')}}", "date_to": "{{moment().subtract(1,'day').format('YYYY-MM-DD')}}", "display_fields": "full"}Workflow 2: Pending Order Alerts
Section titled “Workflow 2: Pending Order Alerts”[Schedule (every 15min)] -> [PrestaGetOrders] -> [Decision] -> [Email Alert]{ "credentials_id": "presta_tienda", "order_state": 2, "date_from": "{{moment().subtract(2,'days').format('YYYY-MM-DD')}}"}Decision: data.total > 0 -> Send alert
Workflow 3: ERP Sync
Section titled “Workflow 3: ERP Sync”[HTTP Trigger] -> [PrestaGetOrders] -> [Loop] -> [HTTP Request to ERP] -> [Log]Usage with ExecuteScript
Section titled “Usage with ExecuteScript”// Process retrieved ordersconst pedidos = ctx.data.orders;
// Filter orders over 100EURconst pedidosGrandes = pedidos.filter(p => parseFloat(p.total_paid) > 100);
// Calculate total salesconst totalVentas = pedidos.reduce((sum, p) => sum + parseFloat(p.total_paid), 0);
ctx.data = { pedidos_procesados: pedidos.length, pedidos_grandes: pedidosGrandes.length, total_ventas: totalVentas.toFixed(2)};Available Fields in display_fields
Section titled “Available Fields in display_fields”| Field | Description |
|---|---|
id | Order ID |
reference | Unique reference |
id_customer | Customer ID |
current_state | Current state |
total_paid | Total paid |
total_paid_tax_incl | Total with taxes |
total_paid_tax_excl | Total without taxes |
total_products | Products total |
total_shipping | Shipping cost |
payment | Payment method |
date_add | Creation date |
date_upd | Update date |
invoice_number | Invoice number |
delivery_number | Delivery slip number |
- If you specify
order_id, the rest of the filters are ignored and only that order is returned - The
display_fieldsfield can be:full: All fields (default)basic: Only essential fields (id, reference, current_state, date_add, total_paid_tax_incl, id_customer)- Custom list:
id,reference,total_paid,payment
- Dates must be in ISO format (YYYY-MM-DD)
- The recommended maximum limit is 100 to avoid timeouts
Common Errors
Section titled “Common Errors”| Error | Cause | Solution |
|---|---|---|
| ”Order not found” | Incorrect ID | Verify the order ID |
| ”Timeout” | Too many orders | Reduce the limit or add date filters |
| ”No permissions” | Limited API Key | Enable order permissions in the backoffice |
Related Nodes
Section titled “Related Nodes”- PrestaUpdateProduct - Update product stock from an order