inCategory
function, since version 1.3.0
categories: product, category
inCategory(productId, categoryId)
returns true, if product with id productId
belongs to category categoryId
. Category doesn’t have to be primary category.
Expected use case is in conditions - display only products belonging to specific category.
parameters
- productId: number - product id
- categoryId: number - category id
return type:
boolean
examples
inCategory(product.id, 5)
inCategory(product.id, runtime.categoryFilter)