Components with Dynamic Attributes

The dynamic_lookup property for a component attribute specifies which aspect attribute determines the value of the component attribute.

In the following example, the dynamic_lookup property specifies that the value of the aspect attribute category at runtime determines the value of the component attribute Category.

components/productgrid.json
{
  "name": "Product Listing Layout",
  "description": "Product Listing Grid Layout",
  "group": "commerce_layouts",
  "attribute_definition_groups": [
    {
      "id": "productList",
      "name": "Settings",
      "description": "Product List Settings",
      "attribute_definitions": [
        {
          "id": "category",
          "name": "Category",
          "type": "category",
          "required": false,
          "dynamic_lookup":{
              "aspect_attribute_alias": "category"
          }
        }
      ]
    },

	"region_definitions": [...]
}

In the Visual Editor, the merchant can override the category that the page is using and assign a different category to the component. For example, in the SFRA reference implementation, the dynamic banner component uses the category value assigned to the page by default. The component uses the banner image and banner text assigned in Business Manager for the category assigned to the page.

The merchant can edit the category value and assign it to something other than the value the page is using. For example, the merchant can specify that the banner component uses the category mens-clothing regardless of the category assigned to the page.

As the SFRA reference component is implemented, the merchant can also override attributes of the component separately from the dynamic category attribute. For example, the merchant can specify that regardless of the category, the banner always displays an image for women's shoes and handbags.

X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.