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.

Console commands

Commands exposed by Variant Manager. Run from your project root.

variant-manager/activities/clear#

Delete activity log entries.

./craft variant-manager/activities/clear

Deletes entries older than the activityLogRetention setting (default: 30 days).

./craft variant-manager/activities/clear 1

Wipes every activity log entry regardless of age. The 1 is a positional argument, not an option.

Cleared entries are gone permanently; there is no trash to restore from.

See activity log for the dashboard equivalent.

variant-manager/attributes/backfill#

Register an attribute and option for every name and value already stored on a variant.

./craft variant-manager/attributes/backfill

Reads every variant in batches. Anything already registered is skipped, so the command is safe to re-run. New attributes and options appear in the activity log.

Option Default Description
--batchSize 500 Variants read per batch.

The Utilities -> Variant Attributes utility runs the same work in the queue.

resave/variant-attributes#

Re-save every attribute and option.

./craft resave/variant-attributes --update-search-index

Craft’s own resave command, with an action this plugin adds. --update-search-index rewrites the search keywords for each row, which is what picks up a system name stored before the row was last saved. resave/all includes it.

Option Default Description
--update-search-index false Rewrite each row’s search keywords.
--queue false Run in the queue instead of the console.

variant-manager/attributes/orphans#

List attributes and options whose name or value is no longer stored on any variant.

./craft variant-manager/attributes/orphans

Reads every variant, then compares against the registry. Prints one line per orphan and deletes nothing.

./craft variant-manager/attributes/orphans --prune

Deletes them. Anything a variant has started using since the scan is skipped. An attribute takes its display type and field layouts with it, unless allowAdminChanges is off, where the rows are deleted but their project config stays. This is permanent, and any custom field values on the deleted rows are lost.

Option Default Description
--prune false Delete the orphans instead of only listing them.
--batchSize 500 Variants read per batch.

See variant attributes.

variant-manager/variant-maker/plan#

Print what generating a set of combinations would do to a product’s variants.

./craft variant-manager/variant-maker/plan 4054 --select="Container Size=1 Quart,1 Gallon;CSP Color=Custom"

The first argument is the product ID. Prints one line per combination with its status, the SKU and the price, and any SKU warning under it. Saves nothing.

The selection is read from --select rather than the product’s saved builder.

Option Default Description
--select '' Attributes and values to combine, as Name=A,B;Other Name=C.
--mode add One of add, update or replace. Only replace differs here, since the command includes every property on new variants only.
--skuFormat none SKU format. Blank uses the default variant SKU followed by each option.
--basePrice none Price each combination starts from. Blank uses the product’s default variant price.

See Variant Maker.

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