Seems to be at least one if not two bugs in the returns system when refunding/restocking multiple units of the same product variant / line item, when processing refunds for different units independently and selecting different restock options.
A) Choosing to restock one unit, then choosing not to restock another unit in a separate refund, results in being able to restock all units at a later time (duplicating the restock for any previously restocked units).
B) The shopify/returns/create webhook contains incorrect restock and restock_type values, seemingly using the values for the previous line item refund and not the current one. (TBF I’m getting the webhooks through an app which might be the source of the issue, so interesting to see if others can replicate).
To replicate either, follow the below:
Purchase 3 x same variant
- product page stock correct, was 5 avail, now 2 avail, 3 com
Fulfil all 3
- stock correct, 2 avail
Initiate return for 2 of 3.
Process Return for 1/2, select Restock
- stock correct, 3 avail
- shopify/refunds/create webhook correct (restock = true, refund line items: qty = 1, restock type = return).
- order page correctly shows 1/2 returned.
Process Return again, for 1/1 but DON’T select restock.
- stock correct, 3 avail
- webhook now incorrect; same as initial return (restock = true, refund line items: qty = 1, restock type = return).
Click Restock, select 2 of 2.
- Incorrectly allows restock of 2 units, despite 1 already having been restocked.
- stock incorrect, 5 avail (should be 4)
Restock fulfilled item, for 1/1 and select Restock
- webhook incorrect; uses the webhook that should have been present in previous return (restock = false, refund line items: qty = 1, restock type = no_restock).
- stock correct, 5 avail (likely will be incorrect after further items are refunded/restocked)
EDIT: After a bit more testing, seems the webhook issue is that after refunding a line item unit with a restock, any future refunds for the same line item will also show as a restock (restock = true and restock_type = return) whether or not the restock option is chosen with them.
If a non-restock refund is done first, this isn’t an issue, until a restock refund is done.
Also doesn’t affect anything other than the webhook as far as i see (stock counts don’t change incorrectly in admin).
EDIT 2: narrowed the webhook issue down to the API restock and restockType values being unique to a RefundLineItem, but NOT to a unit within that, and once set to REFUND / restock=true, will not set back to NO_RESTOCK.
Which means any webhooks or future queries to the line item within a refund, once one of the units has been restocked, will not differenciate between restocked and non restocked units even when querying the unique RefundLineItem object (they’re all show as restocked if one of them has been).
So… that’s probably as designed, and would need SF to change or add an additional value in the RefundLineItem object to correctly query units of the same line item for their actual restock status.
Have a feeling the ability to restock more items than you sold is also by design, just dumb.









