# Search refinements, sorting rules and sorting options

*B2C Commerce Developer Study Guide · Data Management Using Business Manager Usage · Last updated November 3, 2026 · https://www.certifyforce.com/study-guide/b2c-commerce-developer/data-management-using-business-manager-usage/search-refinements-sorting-rules-and-sorting-options*

Building the refinement bar and the product order: category refinement definitions and their inheritance, value buckets, the refinement Script API, sorting rule layers and tie-breaking, category-level rule assignment, storefront sorting options, and how script calls pick the effective rule.

- Certification: Salesforce B2C Commerce Developer
- Exam section: Data Management Using Business Manager Usage
- Study guide: https://www.certifyforce.com/study-guide/b2c-commerce-developer

**Official exam objective:**

> Given a business requirement, create and configure a new search refinement and sorting definition that can be used on the storefront.

## What the exam expects

- Create an attribute refinement on the right category, knowing that subcategories add to inherited definitions, and group raw values into buckets.
- Pick the `SearchRefinements` method that fits the panel: filtered definitions, all definitions, or broadening values.
- Build a sorting rule from layered attributes, break ties deliberately, and use Category Position correctly.
- Assign a rule to the root or a subcategory, and add a shopper choice to Sort By with a storefront sorting option.
- Predict which rule a `ProductSearchModel` uses when script sets a rule or option.

Key terms: **refinement definition** (a category-level setting that turns an attribute, category, price or promotion into a filter); **bucket** (a group of raw values shown as one refinement option); **deepest common category** (the lowest category that contains the whole result); **sorting rule** (an ordered list of attributes, each with a direction); **storefront sorting option** (a site-wide Sort By entry that points at a sorting rule).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Refinement inheritance | Root-to-deepest-common-category definitions are concatenated | [Class SearchRefinements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SearchRefinements.html) |
| Keyword search refinements | Defined on the storefront catalog's root category | [Create New Search Refinements](https://help.salesforce.com/s/articleView?id=cc.b2c_creating_new_search_refinement_definitions.htm&type=5&language=en_US) |
| Custom object attributes | Can't be refinements | [Use Custom Object Definitions](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-business-objects.html) |
| Moving refinement definitions | Needs a full index rebuild | [Search Refinement Buckets](https://help.salesforce.com/s/articleView?id=cc.b2c_search_refinement_buckets.htm&type=5&language=en_US) |
| Sorting product attributes | Single-value; online or searchable not required | [Create Sorting Rules](https://help.salesforce.com/s/articleView?id=cc.b2c_creating_sorting_rules.htm&type=5&language=en_US) |
| Custom enum default value | Not applied to products, so sorting ignores it | [Create Sorting Rules](https://help.salesforce.com/s/articleView?id=cc.b2c_creating_sorting_rules.htm&type=5&language=en_US) |
| Empty sort values | Placed last in either direction | [How Sorting Rules Work](https://help.salesforce.com/s/articleView?id=cc.b2c_how_sorting_rules_work.htm&type=5&language=en_US) |
| Global rule context | Needs `Manage_Global_Sorting_Rules`; global dynamic attributes only | [How Sorting Rules Work](https://help.salesforce.com/s/articleView?id=cc.b2c_how_sorting_rules_work.htm&type=5&language=en_US) |
| Sorting options | Site-wide; up to 100 | [Storefront Sorting Options](https://help.salesforce.com/s/articleView?id=cc.b2c_storefront_sorting_options.htm&type=5&language=en_US) |

## Check yourself

- When a script sets both a sorting option and a sorting rule on one model, which is used?
- Why can a blocked refinement still appear in a subcategory?
- When is a Text Relevancy setting of No the right choice?
- Which buckets need no manual value assignment?

## Sources

- [Create New Search Refinements](https://help.salesforce.com/s/articleView?id=cc.b2c_creating_new_search_refinement_definitions.htm&type=5&language=en_US)
- [Search Refinement Definitions for B2C Commerce](https://help.salesforce.com/s/articleView?id=cc.b2c_search_refinement_definitions.htm&type=5&language=en_US)
- [Search Refinement Buckets](https://help.salesforce.com/s/articleView?id=cc.b2c_search_refinement_buckets.htm&type=5&language=en_US)
- [Class SearchRefinements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SearchRefinements.html)
- [Class ProductSearchRefinements](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchRefinements.html)
- [Use Custom Object Definitions](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-business-objects.html)
- [Create Sorting Rules](https://help.salesforce.com/s/articleView?id=cc.b2c_creating_sorting_rules.htm&type=5&language=en_US)
- [How Sorting Rules Work](https://help.salesforce.com/s/articleView?id=cc.b2c_how_sorting_rules_work.htm&type=5&language=en_US)
- [Storefront Sorting Options](https://help.salesforce.com/s/articleView?id=cc.b2c_storefront_sorting_options.htm&type=5&language=en_US)
- [Class ProductSearchModel](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.ProductSearchModel.html)
- [Class SortingRule](https://developer.salesforce.com/docs/commerce/b2c-commerce/references/b2c-script-api/dw.catalog.SortingRule.html)
- [Understanding the Search Pipeline](https://developer.salesforce.com/docs/commerce/b2c-commerce/guide/b2c-understanding-the-search-pipeline.html)
- [Learn About Sorting Rules (Trailhead)](https://trailhead.salesforce.com/content/learn/modules/b2c-storefront-sorting-rules/b2c-learn-about-sorting-rules)
- [How Sorting Rules Work (Trailhead)](https://trailhead.salesforce.com/content/learn/modules/b2c-storefront-sorting-rules/b2c-how-sorting-rules-work)
- [Create Sorting Rules (Trailhead)](https://trailhead.salesforce.com/content/learn/modules/b2c-storefront-sorting-rules/b2c-create-sorting-rules)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 9 linked practice questions, and unlimited timed mock exams are included with the B2C Commerce Developer pack (USD $19): https://www.certifyforce.com/practice-exams
