Commerce prices
Export selection prices and import bulk overrides with revision checks.
Export the effective prices of a canonical commerce definition:
apex commerce price export <experiment> prices.csv
apex commerce price export <experiment> > prices.csvWithout a file, stdout contains CSV even when piped. An explicit --json
returns { data: { csv, revision, contentType } } inside the standard CLI JSON envelope.
The API uses GET /api/v1/experiments/{id}/commerce/price/csv and returns that
JSON body with a quoted revision in the ETag response header. Imports use
PUT at the same path with a text/csv body and If-Match header.
The CSV contains product_id,variant_id,sku,product_title,variant_title,base_price
followed by each editable price version slug in definition order. Prices use the
base currency's minor units. Compare-at versions are read-only and omitted.
Edit price cells, then import:
apex commerce price import <experiment> prices.csv
apex commerce price import <experiment> prices.csv --expected-revision 7Import reads the current definition revision first unless you provide
--expected-revision. It sends that revision as If-Match. Use the revision
from the definition you exported when you need protection against edits since
that export. A stale revision refuses with commerce_definition_revision_conflict.
Keep the header and version order unchanged. variant_id identifies the row;
other informational columns are ignored. An empty cell or a value equal to the
rules' price removes its override. Other values become overrides. Exporting
and importing unedited prices makes no write. Imports print whether anything
changed, override counts, and the resulting revision.
Unknown or excluded variants, malformed money, duplicate variants, and files larger than 2 MB refuse without saving. A refusal exits nonzero and includes the server's code and message.