Dynamic attributes by customer type (B2B)

Enabling different attributes structures based on customer type is easy to facilitate within the Constructor platform. This is commonly used to handle multiple price books for B2B use cases. There are a few notable options when building a product catalog to power this feature.

The most common dynamic attributes are price and availability.

Defining dynamic attributes in a product catalog

The recommended approach is to include availability and price as metadata on either the item (product) or variation records when sending a catalog to Constructor to dictate the different dynamic attributes that exist (for example, pricing structures).

CSV feed - API or FTP

JSON data - REST API

The attributes can be defined (as individual columns, in the case of CSV) to denote the differences for different types of customers. In the example below, multiple price books are defined via metadata.

Price books example - multiple facets

Price books example - multiple price attributes

It is possible to define multiple attributes within a single CSV column. Please refer to the CSV feed format - items (products) guide.

Configure dynamic facets

Once you have uploaded your product catalog, you can configure availability and price as a facet (filter).

A facet will allow users to filter their search or browse results by the options provided. With an availability facet, this would be choosing to view only products available in the US or in a particular price range. You can also use facets in the API, such as filtering results to display prices based on the end users' group.

You can configure facts using the Constructor dashboard or our API.

Hiding dynamic facets from end users

In many cases, it may be preferable not to show end users the newly defined facets. In order to do so, you'll need to set the facet's visibility to hidden. This will ensure the facet doesn't appear as a filter to your end users but still makes the information available via the API.

You will configure facet availability when you configure the facet:

Setting visibility to hidden within Constructor customer dashboard

Setting visibility within Constructor customer dashboard

Requesting results

Once facet(s) have been defined within the product catalog, filters can be added to requests to ensure only data relevant to the current customer type is returned.

  • Add fmt_options[hidden_facets] to the request with a list of facets to be retrieved.
  • Add fmt_options[hidden_fields] to the request with a list of metadata to be retrieved

An example search request may resemble the following:

https://ac.cnstrc.com/search/shirts?key=API_KEY&fmt_options[hidden_fields]=price_grp_a

Please refer to the API Reference for documentation on how to supply filters with requests to retrieve data from Constructor.

Configuring regional sort options

This step is only required if the order of the products are changing when they are sorted by the dynamic field. For example, if dynamic prices are only currency conversions and the order of the products are not changing among regions when they are sorted, this step can be skipped.

For each dynamic field, configure sort options using the Sort options API.

Using the example data preceding, instead of having one sort field for price, you may have multiple. All of the sort options will be returned in the response. In your frontend, sort options that are not applicable to the current region can be filtered out.