Skip to main content

Learn About Sorting Rules

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe the benefits of using sorting rules.
  • List the three types of sorting rules you can configure.
  • Describe four types of attributes you can use when building sorting rules.
  • Explain the difference between search placement and search rank.

Why Sorting Rules?

Brandon Wilson is a senior merchandiser at Cloud Kicks, a high-end sneaker manufacturer. He explored Salesforce B2C Commerce storefront search in the Salesforce B2C Commerce Storefront Search Trailhead module. He wants to use sorting rules to control how B2C Commerce sorts the results that display on the storefront. He needs a context for using these rules and that means developing a strategy. And he’s only limited by his imagination.

Brandon Wilson, Cloud Kicks merchandiser

Here are a few key things Brandon wants to accomplish in his storefront using sorting rules.

  • Help shoppers find products. Not only can he present fabulous product sequences that he knows shoppers will love, he can also show an optimal assortment on the page based on what a shopper has already viewed.
  • Feature best-selling, new, or most popular products. He can do this with active data and category-based rules.
  • Vary product sequencing for repeat customers. He can mix up product sequencing so repeat customers don’t see the same products every time they return to the storefront. He can pull active merchandising data into the equation to personalize the sorting.
  • Increase add to basket and conversion rates. If he configures his sorting rules right, they increase the add-to-basket rate and ultimately conversion. While his immediate goal is to get shoppers to add products to their basket, he wants them to purchase the products.

Sorting Rule Types

To improve his storefront in these ways, Brandon can use three types of sorting rules.

  • Keyword search results
  • Explicit category placement
  • Storefront options

Keyword Search Results

When a shopper enters text into the search field, B2C Commerce uses sorting rules to sort the results. A typical sorting rule has several attributes, applied in layers from top to bottom. You can specify the direction (ascending or descending) for each layer. The attribute in the first layer ranks all products, then the second layer breaks any ties. This continues for all attributes until there are no ties left to break. B2C Commerce applies the same rule for all searches, with customized results based on customized rules.

Category Placement

B2C Commerce uses the sorting rule assigned to the navigational catalog's root category for basic category sorting. All subcategories of this catalog inherit the root sorting rule, if it’s not overwritten on a subcategory level by another sorting rule. The category position attribute places specific products in a particular order for a specific category (only if category position is included in the sorting rule).

Storefront Sorting Options

Initially, B2C Commerce uses the default or configured sorting rules to display the search results. Storefront sorting options give shoppers a way to sort further. They display as a dropdown on the storefront, for example, price Low to High. Shoppers see the options, but not the underlying logic. For example, they see the Top sellers choice, but don’t know whether Brandon used units sold or revenue to determine the results.

Where to Use Sorting Rules

Brandon can use sorting rules on the storefront in storefront search, category placement, or storefront sorting options. He can also use sorting rules in the following. 

  • Campaigns
  • A/B testing
  • Predictive sort

When he creates a sorting rule, he can choose to use it on one site or globally across all the sites in his organization. Global sorting rules can only use global dynamic attributes. The actual sorting scores remain site-specific based on-site data. He can change the rule context from an individual site to global (and vice versa) in Business Manger or use import/export functionality.

Campaigns and A/B Tests

Brandon can use sorting rules alone, in a campaign, or in an A/B Test. He can set a default sorting rule for a category in a site catalog, outside the context of a campaign or A/B test.

Commerce Cloud Einstein

Commerce Cloud Predictive Sort allows Brandon to personalize the sorting experience for each shopper based on catalog and product data, order history, and live customer clickstreams. See Smarter Search with Commerce Cloud Einstein

Settings and Attributes

As Brandon sets up sorting rules, he wants to be able to define search results. For example, he’d like to sort results based on profit margin, showing top revenue generators first. To do this, he uses Business Manager settings and data attributes.




Category or product settings

Gain the most control over product ordering.

  • Category position
  • Search placement
  • Search rank

Text relevance settings

Sort based on how closely products match a storefront search. This only works in a search-specific sorting rule.

  • Text Relevance

Product attributes

Sort based on merchant-defined Product data attributes.

  • Brand
  • Price
  • Online From
  • New In*
  • On Sale*
  • Material*
  • Collection*
  • Delivered From Supplier*
  • Rating*
  • Profit Margin**

Active data attributes

Sort based on data collected or calculated by B2C Commerce.

  • Revenue
  • Orders
  • Units Ordered
  • Conversion Rate
  • Impressions
  • Views
  • ATS (Available to Sell)
  • SKU Coverage
  • Availability
  • Availability Ranking
  • Days Available

*Requires a custom attribute. **Requires an import of cost data.

Business Manager Settings

Next, Brandon takes a look at the Business Manager sorting rule settings to decide if wants to use them in his search placement strategy.

Search Placement

Search Placement is a way to group products with a numeric code. For example, when a shopper searches for running shoes, Brandon wants certain types of products to display first, second, and third. He assigns each product type a search placement code so they display in that order. B2C Commerce ranks search placement codes from the highest numeric value to the lowest. The default is eight tiers, and you can customize for more.

Use this setting to accomplish the following.

  • To group items within a category
  • When using category position is too explicit, but you still want merchandising and control of the sort order
  • To group certain products together or promote/demote certain products
  • With search (keyword search) and navigation (categories)

Search Rank

Search rank adds another layer of granularity. Use it to set certain products high, medium, or low within a search placement code group. For example, Brandon wants specific shoes within the ShoeX brand to appear at the top of the list, so he ranks them high. Use this setting as follows.

  • On its own or with search placement
  • For search result pages and View All categories

Category Position

Brandon uses category position to apply an explicit order to each product on a category page, giving him ultimate control of a product’s sort order on that page. In addition to setting this in Business Manager, he must also include it in a sorting rule.

Having total control means that he can easily maintain brand guidelines and push the products he wants to sell. However, B2C Commerce ignores this setting for the search results order and for active data. The products he promotes are his best guess and not necessarily what the shopper wants.

If you only sort by category position and this is the default rule for the root category, add a second layer to the default sorting rule for ties. Category position must be first in the sorting rule to work properly.

Text Relevance

Text relevance is how closely products in search results match what the shopper enters. When the shopper enters a search term, B2C Commerce computes a score for each product based on how many times it finds the term in the searchable attribute, the boost factor, and other weighting factors. The boost factor is a value from 0.01 to 100.00. We recommend that you keep it to 5.00 or less.

  • 1 is the default, and does not change the order of the search results.
  • 2 is twice as important as 1.
  • 0.5 is half as important as 1.

Boost factor only works if text relevance is part of a sorting rule. Use it only for attributes such as product or category name. For example, when a shopper searches for basketball, Brandon wants results from the shoe category to display first (because it’s a shoe company), and products containing the word basketball in the title or description second. He sets the shoe category name attribute to a boost factor of 2, and the title and descriptions attributes to 1. 

Brandon can use text relevancy as an attribute or as an option for a dynamic attribute.

  • Attribute: Include text relevancy as a single attribute or as part of a dynamic attribute. When used in a dynamic attribute, it’s a calculated metric, which rarely has ties. The next sorting rule attribute isn’t used; so make text relevancy the last line of the rule.
  • Option for a dynamic attribute: Some attributes let you choose text relevancy as a layer within a sorting rule.

Data Attributes

Attributes are at the heart of sorting rules. Brandon uses them to specify what he wants shoppers to see first, and in what order. Here are the types of attributes he can use.

  • Product: Use any single-value (non-set) attribute of the product system object in a sorting rule (except Password, Image, Text, HTML, or Email type of attribute). Attributes don't have to be flagged as online or searchable to be used in sorting rules.
  • Active data: Implement the active merchandising feature to capture data for search sorting. This includes data collected from orders on a production system and information collected from storefront pages.
  • Availability model: Implement the availability feature, the active merchandising feature, or both to capture data for search sorting.
  • Dynamic: Sort using custom combinations of attributes that you create.

Next Steps

In this unit you learned about the importance of sorting rules to the shopper experience, where you can use them, and the settings and attributes you can use to configure them. Next, you learn how sorting rules work.


Keep learning for
Sign up for an account to continue.
What’s in it for you?
  • Get personalized recommendations for your career goals
  • Practice your skills with hands-on challenges and quizzes
  • Track and share your progress with employers
  • Connect to mentorship and career opportunities