Skip to main content
The Offer module service reads and writes Offer and OfferCondition rows directly. Use it in subscribers, scheduled jobs, and your own steps when you don’t need what the workflows add on top.

Resolve the service

Resolve the service from the container with MercurModules.OFFER.
The service writes rows only. It doesn’t create prices, inventory items, or links, emit events, or roll back on failure. Use the workflows for anything that touches pricing, stock, or links.

Generated methods

The service extends MedusaService({ Offer, OfferCondition }), which generates these methods for each model:

listOffers and listAndCountOffers with group_by_seller

Both offer list methods accept an extra group_by_seller filter. Without it they behave like the generated methods.
With group_by_seller: true, the service returns one offer per (product_id, seller_id) group, the newest by created_at. Each returned offer gets variant_count and offer_ids for its group, and the count is the number of groups. Grouped mode reads only the product_id and seller_id filters. Pagination uses config.skip and config.take, with take defaulting to 20.

getStatistics

Counts offers, and the distinct stores and products behind them, as they stood at a point in time.
input.at defaults to now. input.filters.seller_id takes one id or a list. An offer counts when it was created at or before at and wasn’t deleted by then.
The result is { offers, sellers, products }, each a number.