Skip to content

Letting customers cancel their own orders

A customer who changes their mind before the goods are moved can cancel the order from their own account. The module determines whether the cancel button is displayed by reading the states the order currently holds and comparing them with three configured lists.

The function depends on a setting located on a different screen. Without a state that means work on the order has begun, no order ever leaves the set of cancellable orders, and the button remains available while an operator is already collecting the goods.

A state that means work has begun is required. This is usually a custom order state, sometimes an existing one. Whichever state it is, it must not be one of the states cancelling is allowed from.

A decision about refunds is also required. Cancelling stops fulfilment; the refund is settled separately. → Refunds

1. Name the state that means work has begun

Section titled “1. Name the state that means work has begun”

Stockly → Settings → Order PackingOrder in progress state. The module moves an order into this state when the picking view is opened, and that is the signal every other screen reads. The field may be left empty, in which case the transition is skipped and no state marks an order as being worked on.

Stockly → Returns → Settings → GeneralLet customers cancel their own orders.

Require a reason is optional. It adds one field to the customer’s dialogue, in which the customer selects from the return reason catalogue, restricted to the reasons marked for cancellation; the selected reason is stored with the cancellation for support to read afterwards.

3. Define the states an order may be cancelled from

Section titled “3. Define the states an order may be cancelled from”

Three lists are read together, and the order has to satisfy all three:

SettingWhat it restricts
Allowed order statesthe stage the order itself has reached
Allowed payment statesthe stage the payment has reached
Allowed delivery stateswhether any part of the order has already shipped

A list left empty imposes no condition on its dimension, so every state qualifies there. On payments and deliveries an order may hold several rows at once, and it qualifies when at least one of them is on the list; on a restricted dimension an order that has no such row at all does not qualify.

The order state machine is asked before the lists are read. The button is offered only where the machine defines a cancel transition out of the current order state, so an order that has nowhere to go is refused regardless of the configuration.

Place a test order and open it in the customer account. The cancel button is displayed. Open picking for that order in Stockly and refresh the account page: the button is no longer displayed, because the order has moved into the in-progress state, which is not on the allowed list.

With this function enabled, the module’s own button replaces Shopware’s native cancel action for that shop, so customers are not offered two different routes with two different consequences.