Skip to content

PrestaShop - Get Orders

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.

Uses the same credentials as other PrestaShop modules. Make sure the API Key has read permissions on “orders”.

  • orders - GET (read)
  • order_states - GET (optional, to filter by status)
FieldTypeRequiredDescription
credentials_idstringYesPrestaShop credentials ID
order_idnumberNoSpecific order ID
order_referencestringNoOrder reference (e.g.: ABCD1234)
order_statenumberNoOrder state ID
customer_idnumberNoCustomer ID
date_fromstringNoDate from (YYYY-MM-DD)
date_tostringNoDate to (YYYY-MM-DD)
limitnumberNoResult limit (default: 50)
sort_bystringNoSort field (default: id)
sort_orderstringNoOrder: ASC or DESC (default: DESC)
display_fieldsstringNoFields to show: full, basic, or comma-separated list
IDState
1Awaiting check payment
2Payment accepted
3Preparation in progress
4Shipped
5Delivered
6Cancelled
7Refunded
8Payment error
9Awaiting PayPal payment
10Remote payment accepted

Note: IDs may vary depending on your store configuration.

{
"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"
}
}
{
"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
}
{
"credentials_id": "presta_tienda",
"order_id": 123
}
{
"credentials_id": "presta_tienda",
"order_reference": "ABCD1234"
}
{
"credentials_id": "presta_tienda",
"order_state": 3,
"limit": 100,
"sort_by": "date_add",
"sort_order": "ASC"
}
{
"credentials_id": "presta_tienda",
"customer_id": 456,
"limit": 20
}
{
"credentials_id": "presta_tienda",
"date_from": "2024-01-15",
"date_to": "2024-01-15",
"display_fields": "basic"
}
{
"credentials_id": "presta_tienda",
"order_state": 4,
"limit": 10,
"sort_by": "date_add",
"sort_order": "DESC"
}
{
"credentials_id": "presta_tienda",
"date_from": "2024-01-01",
"date_to": "2024-01-31",
"display_fields": "id,reference,total_paid,current_state,date_add"
}
[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"
}
[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

[HTTP Trigger] -> [PrestaGetOrders] -> [Loop] -> [HTTP Request to ERP] -> [Log]
// Process retrieved orders
const pedidos = ctx.data.orders;
// Filter orders over 100EUR
const pedidosGrandes = pedidos.filter(p => parseFloat(p.total_paid) > 100);
// Calculate total sales
const 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)
};
FieldDescription
idOrder ID
referenceUnique reference
id_customerCustomer ID
current_stateCurrent state
total_paidTotal paid
total_paid_tax_inclTotal with taxes
total_paid_tax_exclTotal without taxes
total_productsProducts total
total_shippingShipping cost
paymentPayment method
date_addCreation date
date_updUpdate date
invoice_numberInvoice number
delivery_numberDelivery slip number
  • If you specify order_id, the rest of the filters are ignored and only that order is returned
  • The display_fields field 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
ErrorCauseSolution
”Order not found”Incorrect IDVerify the order ID
”Timeout”Too many ordersReduce the limit or add date filters
”No permissions”Limited API KeyEnable order permissions in the backoffice
  • PrestaUpdateProduct - Update product stock from an order