Hello!
I’m trying to set up some basic product attributes/options via the config.yml file using Netlify CMS.
Currently, the following lets a user create product attributes as well as options for each attribute respectively. It also allows a user to add attributes to a product. I’m trying to figure out how to allow a user to then add any or all of the options associated with the added attribute.
Example: User creates a ‘Size’ product attribute and adds ‘S’, ‘M’, ‘L’, ‘XL’, and ‘2XL’ as options. In the product, the user adds the ‘Size’ attribute. The user should now be able to select/add the options they want for that product’s attribute.
Is this possible?
- label: Products
label_singular: Product
name: products
folder: content/products
create: true
fields:
- {
label: "Template Key",
name: template-key,
widget: hidden,
default: "product-page",
}
- { label: "Slug", name: slug, widget: "string" }
- { label: "Title", name: title, widget: "string" }
- { label: "SKU", name: sku, widget: "string" }
- {
label: "Attributes",
name: attributes,
widget: list,
fields:
[
{
label: "Attribute",
name: attribute,
widget: "relation",
collection: product-attributes,
searchFields: [title],
valueField: title,
displayFields: [title],
},
],
}
- { label: "Price", name: price, widget: "number" }
- { label: "Image", name: image, widget: "image" }
- { label: "Description", name: description, widget: "markdown" }
- label: "Product Attributes"
label_singular: "Product Attribute"
name: product-attributes
folder: content/product-attributes
create: true
fields:
- { label: "Title", name: title, widget: "string" }
- {
label: Option,
name: option,
widget: list,
fields: [{ label: "Title", name: title, widget: string }],
}