Reordering
Let customers reorder items from a previous order by fetching the order items and adding them to a new cart. This is a frontend flow that combines an order query with cart mutations. Propeller does not have a dedicated reorder mutation, so your application handles the logic.
Reordering is one of the most used features in B2B portals. Businesses regularly restock the same items (office supplies, raw materials, maintenance parts, safety equipment) and expect to do this with minimal clicks. A well-built reorder flow saves buyers significant time compared to searching for and adding each product individually.
For cart creation and item management, see Cart management. For listing and filtering orders, see Order history.
How reordering works
A reorder flow has three steps:
- Fetch the original order's items
- Create a new cart (or use an existing one)
- Add each product item to the cart
The cart uses current pricing. Prices may have changed since the original order was placed.
Only order items with
class: productshould be reordered. Order items can also have classes likeincentiveorsurcharge, which are system-generated and should not be added to the cart manually.
Step 1: Fetch the order items
Query the original order and include the fields needed for reordering: productId, quantity and class. Include sku and name for display purposes.
Query
query OrderForReorder($orderId: Int!) {
order(orderId: $orderId) {
id
items {
id
class
productId
sku
name
quantity
notes
}
}
}
Variables
{
"orderId": 2075
}
Response
{
"data": {
"order": {
"id": 2075,
"items": [
{
"id": 20151,
"class": "product",
"productId": 1187,
"sku": "157957",
"name": "Douglas Lariks fijn bezaagd ZWART",
"quantity": 4,
"notes": ""
},
{
"id": 20152,
"class": "product",
"productId": 1139,
"sku": "VFS-200",
"name": "Ventilatie Filterset Fresh Air",
"quantity": 2,
"notes": ""
},
{
"id": 20153,
"class": "product",
"productId": 204,
"sku": "695123-3",
"name": "Power cord 2x1.50 4.0mtr",
"quantity": 3,
"notes": ""
}
]
}
}
}
Filter the items in your frontend to include only those where class is product. Discard items with class values like incentive or surcharge.
Step 2: Create a new cart
If the customer does not already have an active cart, create one using cartStart.
Mutation
mutation CartStart {
cartStart {
cartId
}
}
Response
{
"data": {
"cartStart": {
"cartId": "019c9f63-c127-70ca-8bac-ec3dd43c8bfd"
}
}
}
If the customer already has an active cart, you can add the reorder items to it directly. See Cart management for details on creating and managing carts.
Step 3: Add items to the cart
For each product item from the order, call cartAddItem with the productId and quantity.
Mutation
mutation CartAddItem($id: String!, $input: CartAddItemInput!) {
cartAddItem(id: $id, input: $input) {
cartId
items {
itemId
productId
quantity
price
priceNet
totalPrice
totalPriceNet
product {
productId
names {
value
language
}
sku
}
}
total {
subTotal
subTotalNet
totalGross
totalNet
}
}
}
Variables
{
"id": "019c9f63-c127-70ca-8bac-ec3dd43c8bfd",
"input": {
"productId": 1187,
"quantity": 4
}
}
Response
{
"data": {
"cartAddItem": {
"cartId": "019c9f63-c127-70ca-8bac-ec3dd43c8bfd",
"items": [
{
"itemId": "019c9f63-da2c-7006-8aeb-f47c2b86d861",
"productId": 1187,
"quantity": 4,
"price": 24.54,
"priceNet": 29.69,
"totalPrice": 98.16,
"totalPriceNet": 118.77,
"product": {
"productId": 1187,
"names": [
{
"value": "Douglas Lariks fijn bezaagd ZWART",
"language": "NL"
}
],
"sku": "157957"
}
}
],
"total": {
"subTotal": 98.16,
"subTotalNet": 118.77,
"totalGross": 153.16,
"totalNet": 185.32
}
}
}
}
Repeat the cartAddItem call for each product item from the order. Each call returns the updated cart with all items and totals. For orders with many items, cartItemBulk (documented in Cart management) is more efficient because it adds or updates all items in a single API call instead of sequential calls per item.
CartAddItemInput fields
| Field | Type | Required | Description |
|---|---|---|---|
productId | Int! | Yes | The product to add |
quantity | Int | No | Quantity to add (default: 1) |
notes | String | No | Customer notes for this item |
clusterId | Int | No | Cluster ID if the product belongs to a cluster |
price | Float | No | Override price per unit (for external pricing only) |
childItems | [CartChildItemInput!] | No | Child items for configurable cluster products |
Handling unavailable products
Products from the original order may no longer be available. Before adding an item, you can check the product's status by including the product field in the order query:
query OrderForReorder($orderId: Int!) {
order(orderId: $orderId) {
id
items {
id
class
productId
quantity
product {
productId
names {
value
language
}
sku
status
orderable
}
}
}
}
Check the product.status and product.orderable fields before attempting to add the item to the cart. If status is not A (available) or orderable is N, the product cannot be ordered and you should inform the customer.
| Status | Meaning |
|---|---|
A | Available |
N | Not available |
P | Phase out |
S | Presale |
R | Restricted |
T | Out of stock |
The
productfield on an order item can returnnullif the product has been deleted from the catalog since the order was placed. Handle this case in your frontend by showing a message that the product is no longer available.
Pricing differences
The cart uses current pricing, not the prices from the original order. If you want to show the customer that prices have changed, you can compare the order item's price field (the price at the time of the original order) with the cart item's price field (the current price).
query OrderWithPrices($orderId: Int!) {
order(orderId: $orderId) {
items {
id
class
productId
name
quantity
price
priceNet
}
}
}
{
"data": {
"order": {
"items": [
{
"id": 26987,
"class": "product",
"productId": 44,
"name": "EcoSpot Recessed Downlight",
"quantity": 10,
"price": 309.14,
"priceNet": 374.06
},
{
"id": 26992,
"class": "product",
"productId": 12,
"name": "Eclipse Elite LED Desk Lamp",
"quantity": 5,
"price": 85.49,
"priceNet": 103.44
}
]
}
}
}
The order item price is the unit price excluding tax at the time the order was placed. The order item priceNet is the unit price including tax. Compare these with the cart item's price and priceNet after adding to identify any changes.
Cluster products
If the original order contained products that belong to a cluster (variant products), include the clusterId when adding them to the cart. You can retrieve the cluster ID from the order item's product:
query OrderForReorder($orderId: Int!) {
order(orderId: $orderId) {
items {
id
class
productId
quantity
product {
productId
cluster {
clusterId
}
}
}
}
}
{
"data": {
"order": {
"items": [
{
"id": 25978,
"class": "product",
"productId": 45,
"quantity": 1,
"product": {
"productId": 45,
"cluster": null
}
},
{
"id": 25981,
"class": "product",
"productId": 56,
"quantity": 1,
"product": {
"productId": 56,
"cluster": {
"clusterId": 1
}
}
}
]
}
}
}
When product.cluster is not null, pass the clusterId to cartAddItem:
{
"id": "019c9f63-c127-70ca-8bac-ec3dd43c8bfd",
"input": {
"productId": 1187,
"quantity": 4,
"clusterId": 52
}
}
Next steps
- Order history for listing and filtering orders
- Cart management for creating carts and managing items
- Checkout flow for completing the checkout after reordering