commerce icon indicating copy to clipboard operation
commerce copied to clipboard

Memoize inventory query results

Open johnnynotsolucky opened this issue 8 months ago • 1 comments

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

johnnynotsolucky avatar Jun 21 '25 20:06 johnnynotsolucky

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

joshuapease avatar Jun 21 '25 22:06 joshuapease

Closed in favor of these performance improvements: 82c605009c908228449540f0c3fc549e93286cc6, 070944f5a7b22b3ed014382146ae08c5c5d9fdf8, 633ae393aec269fe59d60835d7dd91481a912903, 6470c6b0f4113a0e78b4b201d69cf86258b500e7, and 237478671bddf02b71066cb65f06d66511e0a13e

Thanks!

lukeholder avatar Jul 30 '25 10:07 lukeholder