Skip to content

Commerce Foundations is our pre-built Craft Commerce store. See what it includes

Craft CMS plugins

Variant Manager

A Craft CMS plugin that imports and exports Craft Commerce product variants from CSV files.

Variant Attributes field

The custom field type that Variant Manager uses to store option name and value pairs on each variant.

What it stores#

The field’s value is an array of associative arrays, each one an attribute name and value:

[
    ['attributeName' => 'Color', 'attributeValue' => 'Red'],
    ['attributeName' => 'Size', 'attributeValue' => 'Small'],
]

It is persisted as JSON in the element content row (Schema::TYPE_JSON).

Filtering in queries#

Use the field handle as an element-query parameter on craft.variants() (Twig) or Variant::find() (PHP). The filter accepts a string, an associative array, or a list of either.

See querying variants for the supported filter shapes and SQL behavior.

In the control panel, each registered attribute is its own filter under Add a filter, on both variant and product listings. On a product listing the filter is applied through Commerce’s hasVariant param, so a product matches when one of its variants does.

We can take it from here.

We take on the Craft and Craft Commerce sites you built, so you can get back to building. Introduce a client who signs a management contract and you get a $3,000 partnership fee.

How the Dev Partnership Program works
See if we’re a fit