> For the complete documentation index, see [llms.txt](https://kb.craftformswp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.craftformswp.com/documentation/woocommerce/generate-options-from-products.md).

# Generate Options From Products

Fill a Radio or Checkboxes field with your WooCommerce products: one option per product in a category. Each option can take the product's featured image and price, and its attributes (colour, pattern) become filter values, so visitors can narrow a long list with [Filter & Search](/documentation/form-building/create-form/blocks/radio-field.md#filter-and-search).

Use it for fabric samples, paint colours, spare parts, or any long list you already keep as products.

### What you need

* **CraftForms PRO** (from version 2.1.0).
* **WooCommerce**, with the products in a product category. Only published products are used.

### Generate the options

1. Open your form and select the Radio or Checkboxes field.
2. In the block settings, under **Options**, click **Generate from products…**.

   ![The Generate from products button under Options](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FvZlJQ7tGGjX9i3RrmFrM%2Fgenerate-options-from-products--generate-button.jpg?alt=media)
3. In **Product category**, pick the category. The number after each name is the category's product count.
4. Leave **Include subcategories** on to also use the products of its subcategories.
5. Choose **Option label**: **Product name** or **SKU**.
6. Choose **Option value**, what the form saves when the option is picked: **SKU (slug if empty)**, **Product name**, **Slug** or **Product ID**.
7. Under **Filters (Filter & Search)**, tick what visitors can filter by: **Subcategory**, **Tag**, or any of your product attributes (like Colour or Pattern).
8. Leave **Featured images** on to give each option its product's image, and pick an **Option style**: **Image swatch**, **Card**, or **Keep current style**.
9. Turn on **Product prices as option prices** to copy each product's price into its option.
10. Under **Existing options**, choose what happens to the options the field already has (see below).
11. Click **Preview**. A note says how many products were found and names the first few.
12. Click **Use N products** (for example **Use 150 products**).

![The Generate options from products window, ready to use 150 products](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FpEO7xraj5WizwzYchVDN%2Fgenerate-options-from-products--generate-modal.jpg?alt=media)

13. Save the form.

The field now lists one option per product, with the filter dropdowns and search box above them.

![The generated options with Färger and Mönster filters and a search box](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FPK83Tf3Xgbfl2zMLBSWQ%2Fgenerate-options-from-products--generated-options.jpg?alt=media)

### Replace, merge or append

**Existing options** decides what happens to the options already in the field:

* **Replace them**: the field gets the product options only. Your old options are removed.
* **Merge: update matching values, add new ones**: an existing option with the same value as a product gets that product's label, image, filter values and (if **Product prices as option prices** is on) price. Options with no matching product stay as they are. Products that aren't in the field yet are added at the end.
* **Append new values only**: existing options aren't touched. Only products whose value isn't in the field yet are added.

Options are matched by their **value**, so keep the same **Option value** setting each time you run it.

### The options are a copy

Generating is done once. The options don't stay linked to the products: when you change a product's name, price or image later, the field doesn't change. To refresh the list, run **Generate from products…** again with **Merge: update matching values, add new ones**, then save the form.

### How attributes become filter values

Each filter you tick becomes a dropdown above the options, and **Filter & Search** is switched on for the field. Filters the field already has are kept.

Each option gets the product's terms as its filter values. A product with two colours gets both, like `Grå, Vit`, and shows under either colour. For **Subcategory**, the category you picked isn't used as a value, only its subcategories.

To rename a filter or the text of its "all" entry, open the field's **Filter & Search** panel. To check or change one option's filter values, open that option (the ⋮ next to it) under **Options**. See [Radio Field](/documentation/form-building/create-form/blocks/radio-field.md#filter-and-search).

### Good to know

* Products are sorted by name, with numbers in natural order (80 before 106).
* Option values must be unique in a field. If two products have the same SKU, the second gets `-2` added, the third `-3`.
* With **Image swatch**, a field that had no swatch size gets 72 × 72 px swatches. Change the size under **Options Settings**.
* If the field's default choice isn't among the new options, the default is cleared.
* One run uses up to 500 products. When a category has more, the note in the window says **Only the first 500 are used.** Pick a smaller category, or a subcategory, and append the rest.

### After generating

* **Save the form.** Nothing changes on your site until you do.
* **Different options per product or item**: one form can show a different set of choices on different products. Use **Field Options** on a WooCommerce product (see [Extending Form For WC Product](https://kb.craftformswp.com/documentation/woocommerce/extending-form-for-wc-product)) or on a catalog item (see [Add/Modify Catalog Item](/documentation/ecommerce/catalog/add-modify-catalog-item.md#field-options)), with **Override** or **Merge**.
