Forum

Thread tagged as: Question, Shop

Limit number of Categories

Hi, I would like to limit the number of categories the user can pick from a set. For instance,

<perch:categories id="category" set="products" type="dropdown" label="Category">
    <perch:category id="catTitle" />
</perch:categories>

I have this html within the template for a product, and using that html I can pick 1 or more categories from the set products. But in this case, I want to force the user to just pick one. How would I change the html in order to do that ?

Gustavo Bica

Gustavo Bica 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Gustavo,

You should be able to use the max attribute:

<perch:categories id="category" set="products" label="Category" max="1">
<perch:category id="catTitle" />
</perch:categories>

Perfect ;) thank you