Skip to main content

Create Sorting Rules

Learning Objectives

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

  • Configure a sorting rule by using single attributes.
  • Preview a category sorting rule.
  • Configure a hybrid sorting rule.
  • Configure a storefront sorting option by using a dynamic attribute.

Create Sorting Rules

If you’re just getting started with sorting rules, it’s best to start small and add more granularity as you gain confidence. In this unit, you create sorting rules for three scenarios.

  • A sorting rule with a single attribute
  • A hybrid sorting rule
  • A storefront sorting option with a dynamic attribute

Create a Sorting Rule with a Single Attribute

Creating a sorting rule with one attribute in Salesforce Agentforce Commerce for B2C is a straightforward way to control the order in which shoppers see products on the storefront. It’s also an easy way to get started working with sorting.

For this demonstration, you want to boost high-inventory products in the Sales category to the top of the search results. There are many ways that you can configure sorting rules to sort product ranking. Here are some ranking attribute options to consider.

Goal

Attribute to Use

Attribute Type

Keep out-of-stock products online.

Availability Rank 

Standard Attribute

Configure base products with multiple variations that have varying stock across the range of sizes, colors, and materials.

SKU Coverage 

Availability Model

Boost products that have multiple units left.

ATS

Availability Model

Boost products with a good range of stock across all variations.

Combine ATS and SKU Coverage in a dynamic attribute

Availability Model

Boost slow-sellers.

Sales Velocity or Time To Out Of Stock (TTOS)

Active Data

The available to sell (ATS) attribute is perfect for this outcome. Our sorting rule uses ATS first (from highest to lowest). For any products with the same score, the rule shows the ones with higher revenue first.

Here’s how to create this sorting rule.

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | Sorting Rules.
  2. Click New.
    In Business Manager, the Sorting Rules page has three sections: Sorting Rules, Attributes, and Preview.
    The page has three sections: Sorting Rules, Attributes, and Preview.
  3. Enter a unique rule ID and description for example: availability-rank-01
  4. Click Add in the Attributes section.
    On the Business Manager Sorting Rules page, select the attributes to add to a sorting rule.
  5. From the dropdown, scroll to the section you want, and select: ATS
  6. Click Apply.
    In the Business Manager Sorting Rules module, the new sorting rule uses two attributes: ATS and Revenue (30 Days).
  7. Keep the text relevancy settings to No for the attribute.
Note

Selecting Yes means that the text relevance score (from 0 through 1) is multiplied by the score of the attribute you use for the rule. This value conversion is the equivalent of a 50%–50% weighting between the selected attribute and the text relevance score. Use Yes when multiple items can have the same score from the sorting attribute, such as a recommendations sort, or when sorting for best-selling items.

  1. In the Direction column, leave the attribute Descending.

Add a Second Attribute to Break Ties

The sorting rule with a single attribute lists products with the highest available inventory in descending order. To break ties and further define the product order, you can add a second attribute.

  1. Click Add in the Attributes section.
  2. From the dropdown, scroll to the section you want, and select:
    1. Revenue (30 days) (activeData.revenueMonth)
  3. Keep the text relevancy settings to No for the attribute.
  4. In the Direction column, leave the attribute Descending.
  5. Click Apply.

Preview Sorting Rules

Here’s how you preview the sorting rule.

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | Sorting Rules.
  2. Select the sorting rule that you created: Availability-Rank-01
  3. In the Preview section, select Sale from the category list.
  4. Enter a search term: shorts
  5. Click Preview.

Products appear based on the search term. If no products meet the specific attribute requirements, you still see products in the preview category that have the search term in the product name.

In Business Manager, preview sorting rules by selecting the rule and a category, and entering a search term.

You can use the Storefront Toolkit to examine search results. The tool shows the sorting rule used to determine search results, the sorting criteria within the rule, and the sorting criteria values for each search result.

Create a Hybrid Sorting Rule

In the previous unit, you created a custom product attribute called isSale. In this example, you create a hybrid sorting rule that pushes sales items to the bottom of the search results. The sorting rule is a combination of category position and a custom product attribute.

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | Sorting Rules.
  2. Click New.
  3. Enter a unique rule ID: rule-03-hybrid
  4. Enter a description: Push to bottom.
  5. Click Add in the Attributes section and select from the dropdown:
    • Standard attribute: Category Position
    • Product attribute: On sale?
    • Active data attribute: Views (30 Days)
  1. Click Apply.
    In the Business Manager Sorting Rules module, the new hybrid sorting rule uses three attributes: Category Position, On sale, and Views (30 Days).
  2. Keep the text relevancy settings to No for all attributes.
  3. In the Direction column, leave them set to Ascending and Descending, respectively.
  4. Click Apply.

Create a Storefront Sorting Option with a Dynamic Attribute

In the previous unit, you learned that dynamic attributes make near real-time sort adjustments based on storefront activity and sales, for both category and keyword search.

In this demonstration, you use a dynamic attribute to configure a new storefront option for a dropdown that shows a combination of new arrivals and bestsellers. To set up this sorting option, complete this process.

  1. Create a dynamic attribute.
  2. Create a sorting rule that uses the dynamic attribute.
  3. Create a storefront option that uses the sorting rule.

Create a Dynamic Attribute

You want the new dynamic attribute, called bestSellers, to blend sales velocity (descending, average, 60% weighting) and views (descending, minimum, 40% weighting). Agentforce Commerce for B2C calculates the sales velocity and days available, with the search results now showing a blend of both.

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | Sorting Rules.
  2. Click Dynamic Attribute.
  3. Click New.
  4. Enter a unique attribute ID:bestSellers
  5. Enter a description: Blend sales velocity and views
  6. Click Add in the Attributes section.
  7. Select active data attributes from the dropdown:
    • Sales Velocity (30 Days)
    • View (30 Days)
  1. Select the settings for each attribute:
    • Descending, Average, 60% weighting
    • Descending, Minimum, 40% weighting
  1. Click Apply.
    In the Business Manager Sorting Rules module, create a new dynamic attribute with two attributes: Sales Velocity and Views.

Create a Sorting Rule for the Dynamic Attribute

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | Sorting Rules.
  2. Click New.
  3. Enter a unique rule ID: sorting-02-dynamic
  4. Enter a description: Dynamic rule
  5. Click Add in the Attributes section.
  6. Select the dynamic attribute from the dropdown: bestSellers
  7. Click Apply.
  8. Set text relevancy (No) and Direction (Descending). If you set text relevancy to Yes, Agentforce Commerce for B2C multiples the sorting attribute score by the text relevancy score.
    In Business Manager, create a sorting rule, sorting-02 that uses a dynamic attribute, hotItems.

Configure a Storefront Option for the Sorting Rule

Here are the steps you use to configure a storefront option so that the new sorting rule shows at the top of the Top Sellers list and at the top of the storefront option dropdown.

  1. In Business Manager, click App Launcher, and select Merchant Tools | Site | Search | storefront sorting options.
  2. Click New.
    In Business Manager, Storefront Sorting Options module, create a new sorting option.
  3. Keep the site language: Default
    When you select a new language to configure, the values for the Display Name clear for that language. If you don't have sites in different languages, select Default or the locale for the current site.
  4. Enter a unique ID: storefront-topsellers
  5. Enter a Display Name: Holiday Top PicksThis is the name that shows in the storefront.
  6. Select a sorting rule from the dropdown: sorting-02-dynamic.
  7. Click Apply.
  8. Click <<Back to List.
  9. Select storefront-topsellers.
  10. Click the sorting arrowMove to the top icon to make this option a priority.
  11. Click Apply.
    In the Business Manager Storefront Sorting Option module, you can control the storefront option drop down order of display.

The new rule shows at the top of the list and at the top of the storefront option dropdown.

Let’s Wrap It Up

In this unit, you created a sorting rule with a single attribute, a storefront sorting option with a dynamic attribute, and a hybrid sorting rule.

In this badge you learned that Agentforce Commerce for B2C sorting rules are essential tools for managing search results and category pages to drive higher conversion rates. You explored the three primary rule types, the inheritance model for rule processing, and how to leverage manual, product, and dynamic attributes to execute your storefront merchandising strategy.

Resources

Salesforce 도움말에서 Trailhead 피드백을 공유하세요.

Trailhead에 관한 여러분의 의견에 귀 기울이겠습니다. 이제 Salesforce 도움말 사이트에서 언제든지 새로운 피드백 양식을 작성할 수 있습니다.

자세히 알아보기 의견 공유하기