ATTRIBUTE_KEYS_FOR_ATTRIBUTE_BASED_SHIPPING_OPTION

Type: array (ListSerializer) Default: [] Description: Configuration for attribute-based shipping option grouping. Defines how products are grouped by attribute values and which grouping applies based on shipping address location.

How It Works:

  1. Rules are evaluated in sort_order priority (lower values first)

  2. The first rule that matches the shipping address determines the group_attribute_key

  3. Products are grouped by the VALUE of the selected attribute key

  4. Products without the attribute are grouped under "None"

Entry Structure:

  • group_attribute_key (string or array, required): Attribute key(s) used for grouping.

    • Single key: "warehouse_location" → groups by that attribute's value

    • Multiple keys: ["brand", "category"] → creates composite group keys like "Nike;shoes"

  • rule (object, required): Location-based rule that determines when this grouping applies.

    • Available rules: any-rule, country-rule, city-rule, township-rule, district-rule, postal-code-rule, not-rule, and-rule, or-rule

    • Rule structure: {"slug": "country-rule", "countries": [1, 2], "exclude": false}

  • sort_order (integer, required): Priority for rule evaluation (lower = higher priority)

Example Configuration:

[
  {
    "group_attribute_key": "warehouse_location",
    "rule": {"slug": "country-rule", "countries": [1, 2], "exclude": false},
    "sort_order": 1
  },
  {
    "group_attribute_key": ["brand", "category"],
    "rule": {"slug": "city-rule", "cities": [5], "exclude": false},
    "sort_order": 2
  },
  {
    "group_attribute_key": "supplier",
    "rule": {"slug": "any-rule"},
    "sort_order": 99
  }
]

Resulting Groups (example):

  • Address in country 1: Products grouped by warehouse_location values (e.g., "istanbul", "ankara", "None")

  • Address in city 5 (not in countries 1, 2): Products grouped by composite keys (e.g., "Nike;shoes", "Adidas;None")

  • Other addresses: Products grouped by supplier values

Used in: AttributeBasedShippingOptionSelectionPage to group products by attribute values

Last updated

Was this helpful?