OnlyXLeftInStockResolver
Magento\InventoryGraphQl\Model\Resolver\OnlyXLeftInStockResolver
What it does
This GraphQL resolver calculates and returns the 'Only X Left in Stock' quantity for products when stock levels fall at or below a configured threshold.
Developers use this when implementing GraphQL queries that need to display low-stock warnings to customers, helping create urgency in the shopping experience.
It handles special cases like bundle products and returns null when the threshold isn't configured or when stock levels are above the threshold.
Public Methods
- resolve()