← API documentation Services

IProductService

Load and prepare products, categories, variants, and reviews.

Last updated

Usage

The Umbraco implementation is registered with a scoped lifetime. Inject it into controllers or services to load products and prepare them for display.

Member Purpose
GetProductById(int) Returns a product or null.
GetProductsByProductGroupId(...) Loads products in a group, with options for sold-out items, secondary groups, and subcategories.
GetAllProductsFiltered(Filtrering) Filters products by search, category, price, and sorting.
PrepareForDisplay(Product) Prepares one product for presentation.
GetReviewsByProductId(int) Loads product reviews.
GetProductGroupById(int) Loads a product group.
csharp
public class MyController(IProductService products) : Controller
{
    public IActionResult Details(int id) => View(products.GetProductById(id));
}

Source: OptimusCommercev2.Core/Interfaces/IProductService.cs · Optimus Commerce.Extension 17.94.0