What happened?
Description
Noticed a behavior where running recalculation on a completed order can result in line items being removed if their purchasables' stock has reached 0 Available or been marked as not available for purchase.
Steps to reproduce
- Complete an order containing a line item for purchasable X.
- Either set purchasable X's Available inventory to 0 or toggle its Available for purchase field off.
- On the order's edit page in the CP, click Edit, then click Recalculate order.
Expected behavior
Order recalculates adjustments but retains line items based on their availability when the order was placed.
Actual behavior
The entire order is recalculated, removing line items based on their purchasables' current stock and availability. Even if its purchasable has On Hand stock and a committed quantity for the line item, it will be removed if the
Available stock is 0.
Craft CMS version
Craft Pro 5.10.8.1
Craft Commerce version
5.6.6.1
PHP version
8.2.4
Operating system and version
Linux 4.15.0-65-generic
Database type and version
PostgreSQL 14.7
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.7-4)
Installed plugins and versions
No response
What happened?
Description
Noticed a behavior where running recalculation on a completed order can result in line items being removed if their purchasables' stock has reached 0 Available or been marked as not available for purchase.
Steps to reproduce
Expected behavior
Order recalculates adjustments but retains line items based on their availability when the order was placed.
Actual behavior
The entire order is recalculated, removing line items based on their purchasables' current stock and availability. Even if its purchasable has On Hand stock and a committed quantity for the line item, it will be removed if the
Available stock is 0.
Craft CMS version
Craft Pro 5.10.8.1
Craft Commerce version
5.6.6.1
PHP version
8.2.4
Operating system and version
Linux 4.15.0-65-generic
Database type and version
PostgreSQL 14.7
Image driver and version
Imagick 3.7.0 (ImageMagick 6.9.7-4)
Installed plugins and versions
No response