Skip to content

Selections API Reference ​

Selections represent the individual values belonging to a product variation (such as "Red" under "Color" or "XL" under "Size").

Methods ​

  • client.Selections.List(ctx, opts) -> (*PageResponse[Selection], error)
  • client.Selections.All(ctx, opts) -> iter.Seq2[Selection, error]
  • client.Selections.Get(ctx, id) -> (*Selection, error)
  • client.Selections.Create(ctx, req) -> (*Selection, error)
  • client.Selections.Update(ctx, id, req) -> (*Selection, error)
  • client.Selections.Delete(ctx, id) -> error

Usage ​

go
// List selections for a specific variation
opts := &shopier.SelectionListOptions{
	VariationIDs: []string{"var_123"},
}

res, err := client.Selections.List(ctx, opts)
if err != nil {
	log.Fatal(err)
}

for _, sel := range res.Items {
	fmt.Printf("[%s] %s (Variation ID: %s)\n", sel.ID, sel.Title, sel.VariationID)
}

Data Models & Types ​

Selection ​

Represents a specific option choice under a variation (e.g. "XL", "Navy Blue").

FieldTypeJSON TagDescription
IDstringidUnique selection option identifier
TitlestringtitleOption title / value
VariationIDstringvariationIdParent variation axis ID

SelectionCreateRequest ​

FieldTypeJSON TagRequiredDescription
VariationIDstringvariationIdYesTarget variation set ID
TitlestringtitleYesOption name

SelectionListOptions ​

FieldTypeURL ParamDescription
VariationIDs[]stringvariationIdFilter selections by one or more variation IDs
Pageintpage1-based page index
LimitintlimitRecords per page (default: 50)