commerce
commerce copied to clipboard
Memoize inventory query results
Description
This PR attempts to improve performance of operations such as Add to Cart by memoizing inventory levels per request, which are otherwise queried multiple times each, and also preventing inventory look ups where a variant isn't inventory tracked.
Related issues
We've noticed similar slowdowns on our Commerce 5 upgrade.
I've added a ticket outlining our issues.
- https://github.com/craftcms/commerce/issues/4056
Closed in favor of these performance improvements: 82c605009c908228449540f0c3fc549e93286cc6, 070944f5a7b22b3ed014382146ae08c5c5d9fdf8, 633ae393aec269fe59d60835d7dd91481a912903, 6470c6b0f4113a0e78b4b201d69cf86258b500e7, and 237478671bddf02b71066cb65f06d66511e0a13e
Thanks!