-
Notifications
You must be signed in to change notification settings - Fork 175
Closed
Description
Description
We've noticed some really big slowdowns around inventory and cart updates.
LineItem::getFulfilledTotalQuantity() which subsequently calls Inventory::getInventoryFulfillmentLevels() calls the same query to commerce_inventorytransactions
for each line item.
This project has 600,000+ skus, which makes this query especially slow.
We also don't track inventory on this project, so it seems like their might be some efficiency gains if the query could just be skipped for purchasables that don't have $inventoryTracked = true
I noticed this PR was opened recently too
Steps to reproduce
- Have a high number of Variants in Craft (600,000+)
- Add multiple items to cart
Expected behavior
- Only one call to Inventory::getInventoryFulfillmentLevels()
- Ideally this query is bypassed when a purchasable doesn't track inventory.
Actual behavior
- Calls to
Inventory::getInventoryFulfillmentLevels()
grow as line items increase
Craft CMS version
5.7.4
Craft Commerce version
5.3.13
PHP version
8.3
Operating system and version
DDEV
Database type and version
8.0.40
Image driver and version
No response