Hi,
I believed I had already answered to your question in my previous message. Let me be more specific:
You didn't make any mistake.
What you're describing is the normal behavior.
What you're describing is that the stock is not returned if you don't go through either the "confirmed" or "shipped" statuses before selecting one of the "cancelled order statuses".
And that's what I said :
you want to add it in the option "Cancelled order statuses" so that it can be taken into account to give back the stock of the product when you set an order to this status if the previous status of the order was confirmed or shipped.
One thing we could improve on that end in a future version of HikaShop would be to take into account the option "invoice order statuses" instead of only "confirmed" and "shipped" for the decrementing of the stock when an order is cancelled/refunded.
So the solution you're looking for is that the system returns the stock not only when you change the status of orders from confirmed and shipped to a cancelled order status, but from all the "invoice order statuses". That's not the case at the moment and that will require modifications to the system in order to support that in the future.
A simple solution in the mean time, until we develop that, is that you change the status from "sample_sent" to "confirmed" and then to "cancelled" so that the stock will be returned instead of going directly from "sample_sent" to "cancelled".