Salesforce certification · Exam Salesforce-B2C-Commerce-Developer

Salesforce-B2C-Commerce-Developer Mock Exam Page 4

Salesforce B2C Commerce Developer

Free Salesforce-B2C-Commerce-Developer mock exam questions 31–40, each with the answer and an explanation.

20 questions · 30 minutes · free, no sign-up

Free Salesforce-B2C-Commerce-Developer questions

31–40 of 44 free
Question 31 Choose 1
Which method is efficient and scalable because it uses the product search index rather than searching the database?
Show answerHide answer

Correct answer: C ProductSearchModel().getProductSearchHits()

Explanation

Explanation

In Salesforce B2C Commerce (SFCC), the `ProductSearchModel` class (from the `dw.catalog` package) is designed to execute product searches against the product search index rather than querying the database directly. The search index is a pre-built, optimized data structure that enables fast, scalable, and efficient retrieval of product results — especially for large catalogs.

Why the Other Options Are Incorrect

A. `ProductAvailabilityModel.isOrderable()`
– `ProductAvailabilityModel` (from `dw.catalog`) is used to determine product availability and orderability (e.g., whether a product is in stock and can be ordered). It does not perform product searches, and it does not use the search index for searching. It is an availability/inventory model, not a search mechanism. While it may consult inventory data, it is not the efficient, scalable search-index-based method the question describes.

B. `ProductIndexModel.getOrderableProductsOnly()`
– There is no `ProductIndexModel` class with a `getOrderableProductsOnly()` method in the SFCC Script API. This is a fabricated distractor. `ProductIndexModel` is not a real SFCC class, and the method name does not exist. It may sound plausible because it combines "Index" and "Orderable," but it is not valid.

Reference

Salesforce B2C Commerce Script API documentation — `dw.catalog.ProductSearchModel` class, specifically the `getProductSearchHits()` method and its use of the product search index. Also see `dw.catalog.ProductAvailabilityModel` for availability/orderability (unrelated to searching) and SFCC documentation on the distinction between search-index-based and database-based product retrieval.
Question 32 Choose 1
What is the expected outcome when the log reaches the file size limit?
Show answerHide answer

Correct answer: B The current log file is archived and a new log file is created.

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), log files are subject to a configured maximum file size limit. When a log file reaches that size limit, SFCC performs log rotation: the current log file is archived (renamed/rolled over into an archive file), and a new, empty log file is created to continue capturing log messages.

Why the Other Options Are Incorrect:

A. Logging is suspended for the day.
– SFCC does not suspend logging when a file size limit is reached. Logging continues seamlessly; the system rotates the file and keeps writing to a new one. Suspending logging would cause loss of diagnostic data and is not how SFCC behaves.

C. The log file is deleted and a new log file is created.
– SFCC does not delete the existing log file when the size limit is reached. Instead, it archives (preserves) the current file and starts a new one. Deleting the log file would destroy valuable historical log data, which contradicts SFCC's log retention design.

Reference:

Salesforce B2C Commerce documentation — Log Settings and Log Files in Business Manager (Administration > Site Development > Development Setup > Log Settings), specifically the behavior of log file size limits and log rotation/archiving.
Question 33 Choose 1
A developer is working on a new feature that requires the use of a custom script. What is the first step the developer should take?
Show answerHide answer

Correct answer: B Define the custom script in the code.

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), when a developer needs a custom script (for example, a custom hook, a job step script, a payment/order hook, or any extension point), the workflow always begins in the codebase, not in Business Manager.

The first step is to define the custom script in the code — meaning the developer writes/creates the script file within the cartridge's directory structure (e.g., under `cartridge/scripts/...`) and registers it where the extension point expects it. This establishes the script's existence and its relationship to the feature being implemented.

Why the Other Options Are Incorrect:

A. Create the custom script in Business Manager.
– Business Manager is not where scripts are created or authored. Scripts are developed in code and deployed as part of a cartridge. Business Manager is only used to configure or register an existing script (e.g., assigning a hook script, selecting a job step script). Creating a script in Business Manager is not the first step — and in most cases, not even a step at all, since authoring happens in code.

C. Write the logic to handle the custom script.
– Writing the logic is indeed part of the process, but it is not the first step. Before writing the logic, the developer must first define the script in the codebase (create the file, place it in the proper location, and register it at the extension point). Writing logic inside an undefined or unregistered script would not integrate with the feature. Therefore, option C comes after option B in the workflow.

Reference:

Salesforce B2C Commerce documentation — Custom Scripts, Hooks, and Job Step Scripts in the SFCC development workflow, covering script definition, implementation, and registration.
Question 34 Choose 1
A developer working on a multi country site is asked to store country specific data that drives the creation of a country selector. Examples of the data storedare:
Pricebook to be used
Image URL for country flag
The data used in staging also applies in production, but only for this site.
Which approach should the developer take to implement these requirements?
Show answerHide answer

Correct answer: B Create a replicable, site-specific Custom Object with the custom data for each country.

Explanation

Explanation:

Why This Answer Is Correct
Custom Objects are the standard way to extend the B2C Commerce data model for specific business logic. By creating a site-specific Custom Object, the developer ensures that the data is partitioned per site. Furthermore, Custom Objects are replicable, meaning data entered in the Staging instance can be pushed to Production via the standard Replication process. This directly matches the requirement that data used in staging also applies in production. Since the requirements include structured fields such as a Pricebook ID and a Flag Image URL for a country selector, a Custom Object provides a clean, type-safe schema to store and retrieve this information efficiently in code.

Why the Other Options Are Incorrect
A. Extend the Locale System Object
While the Locale system object exists, it is not designed to be flexibly extended with custom attributes like image URLs or custom pricebook mappings. System objects have limitations compared to Custom Objects and are not ideal for storing site-specific business configuration data.

C. Create Site-Specific Content Assets
Content assets are intended for managing HTML or text-based content. Although they can technically store JSON or configuration data, this approach is not type-safe and is considered a workaround rather than a best practice. Content assets are also harder to query and maintain when used for structured logic such as mapping countries to pricebook IDs, compared to querying Custom Objects programmatically.

References
Salesforce B2C Commerce – Custom Objects
Replication of Custom Objects
Question 35 Choose 1
The developer has been given the following business requirement:
The shipping method, Free Standard Ground Shipping' hasan exclusion for products *lth category equals or is child of electronics-televisions.'
The marketing department has scheduled a sale offering a “Free Standard Ground Shipping” method for brand XyzTv televisions for the next 3 months.
What method accomplishes this while following best practices?
Show answerHide answer

Correct answer: C Create an allow list for the existing shipping method by adding a product exclusion for 'brand equals XyzTV" to the exclusion list for "Free Standard Ground Shipping."

Explanation

Explanation:

The scenario involves a shipping exclusion by category (electronics-televisions) and a temporary exception for brand XyzTV. The goal is to offer “Free Standard Ground Shipping” to XyzTV products even though they fall under an excluded category.

Why Option C is Best Practice:
It uses configuration over customization, ensuring:

Maintainability
Business Manager visibility
Minimal developer overhead

By adding an allow list exception for brand = XyzTV, the platform bypasses the broader category exclusion only for that brand.
📌 No code changes required, meaning marketers can manage this promotion without asking developers to modify checkout flows or shipping models.

🚫 Why A & B Are Incorrect
A. Extend shippingMethod.js
Customizing shipping logic in a model introduces risk, requires deployment, and is difficult to manage for temporary promotions.

B. Extend CheckoutShippingServices controller
Breaks clean separation between business logic and UI. Tightly coupling shipping rules with checkout flow makes testing and future changes harder.

🔗 Reference:
“You can exclude products from a shipping method based on category, product, or attribute values. You can define exclusions and also override them by configuring allow lists.” — Salesforce B2C Commerce | Shipping Method Configuration

📖 Official Documentation: Shipping Methods – Commerce Cloud Business Manager
Question 36 Choose 1
A developer has a requirement to display a banner in two different category pages.
Which snippet of code should the developeraddto a template to allow the merchant to configure each independently?

Show answerHide answer

Correct answer: B Option B

Explanation

Explanation:

In Salesforce B2C Commerce (SFCC), particularly in SFRA (Storefront Reference Architecture), merchants configure content slots (banners, promotions, rich text, etc.) per category or page via Business Manager → Merchant Tools → Online Marketing → Content Slots. The tag is the standard ISML tag used to render a slot in templates, allowing merchants to assign different content assets (e.g., image banners, HTML snippets) to the same slot ID on different context objects — in this case, different categories.

Key attributes of <islot> that make option B correct:
- id="category-banner"
→ Unique identifier for the slot. This is what the merchant sees and configures in Business Manager. The same id can be reused across multiple templates/pages.
- description="Categories Banner"
→ Human-readable label shown in Business Manager when assigning content to the slot.
- context="category"
→ Specifies the context type. When set to "category", the slot becomes category-specific. The merchant can then assign different banners to different categories (e.g., one for "Women’s Clothing", another for "Men’s Shoes").
- context-object="${pdict.ProductSearchResult.category}"
→ Dynamically passes the current category object to the slot renderer.
→ pdict.ProductSearchResult.category is the standard way in SFRA category/search templates to access the current category being viewed.
→ This tells the platform: “Show the content assigned to slot category-banner for this specific category.”

Why this allows independent configuration per category page:
Because the slot is tied to context="category" + a dynamic context-object, the merchant can go to Content Slots in Business Manager, select the slot category-banner, and assign completely different content assets to each category independently (e.g., a summer sale banner for "Dresses", a winter collection banner for "Jackets").
No code changes are needed when adding new categories — the merchant simply assigns content to the new category via the UI.

Why not the other options?
- Option A: <banner id="category-banner" ... context-object="${pdict.ProductSearchResult.category}" />
→ There is no <banner> tag in ISML. This is invalid syntax and will cause a rendering error.
- Option C: <icontent context="global" description="Categories Banner" id="category-banner" context-object="..." />
→ <icontent> is not a valid ISML tag.
→ Even if it were <iscontent> (which does exist), setting context="global" makes the slot global (same content everywhere), not category-specific. Merchants cannot configure it differently per category.

Best Practice Summary:
Use <islot> with context="category" (or "product", "folder", "search", etc.) + context-object for any page where you want merchants to control content per context object. This is the recommended pattern in SFRA for category-specific banners, promotions, hero images, etc.

References:
Salesforce Developer Documentation: ISML <islot> Tag → Explains context, context-object, and category-specific usage.
Salesforce Help: Content Slots → Describes configuring slots per category using context-object.
SFRA GitHub / Documentation: Category Page Template → Real-world examples of <islot> with category context.
Trailhead Module: Merchandising with B2C Commerce – Covers slot configuration for category pages.
Question 37 Choose 1
A developer is is configuring Shipping Methods on a storefront. Which of the following considerations must be keptin mind while configuring shipping methods.
Show answerHide answer

Correct answer: A You can exclude products that can't be shippedwith a particular shipping method

Explanation

Explanation:

Why Option A is Correct:
Salesforce B2C Commerce provides robust tools in Business Manager for configuring shipping methods and defining their eligibility rules. One of the primary functions of this system is managing logistics constraints.
Merchants can easily define rules within a specific shipping method configuration (Administration > Order Management > Shipping Methods > [Select Method] > Exclusions) to exclude certain products based on various criteria. Common criteria include product attributes like weight, size (dimensions), categories, or specific product IDs. This allows a merchant to set up rules like "Ground Shipping only for items under 50 lbs" or "Hazardous materials cannot use Air Shipping." This ensures accurate shipping costs and compliance with logistics provider rules are handled automatically during checkout.

Why Other Options Are Incorrect:
B. You can't exclude addresses that aren't used by a particular shipping method: This is incorrect. Shipping methods are heavily configured based on destination address (country, state/province, postal codes). You absolutely can define which addresses a method applies to (e.g., configuring a "Local Pickup" method to only be available for specific ZIP codes or a "USPS Priority Mail" method to only be available for U.S. addresses).

C. You can't define surcharge shipping costs for specific product groups: This is also incorrect. While basic shipping is often based on order total or weight, B2C Commerce allows for complex shipping cost calculations based on product groups, specific products, or complex rules defined in the shipping cost definitions. Merchants can define surcharges or entirely different rates for specific items (e.g., an oversized item fee).

References:
Configure Shipping Methods for B2C Commerce - Salesforce Help
Shipping Method Exclusions Documentation
Trailhead: Manage Shipping in B2C Commerce
Question 38 Choose 1
A client sells its products in North America, Europe, and Asia, and has a B2C Commerce Site for each of these markets. The client receives threearea-specific snippets of analytics code by a third-party provider to insert in the sites.
How should the developer configure an instance to allow the merchant to independently insert and update these snippets?
Show answerHide answer

Correct answer: A Create a new "HTML" attribute in the SitePreference object type.

Explanation

Explanation:

In Salesforce B2C Commerce, site preferences are ideal for enabling merchants to manage site-specific configurations — especially for values like tracking snippets, third-party integrations, or environment toggles. By creating a custom HTML preference, merchants can insert and edit analytics code for each region-specific site directly from Business Manager without touching the codebase.

✅ Why Option A Is Correct
You create a custom SitePreference attribute (e.g., analyticsSnippet) with type html.
Each site (North America, Europe, Asia) can have its own value stored via Business Manager.
Merchants or content managers can update the snippet without developer involvement.

In templates (ISML), you render it using:
${Site.getCustomPreferenceValue('analyticsSnippet')}

📌 Advantage:
Dynamic, scalable, and localized — aligns with best practices for separating config from code.

❌ Why B & C Are Not Suitable

B. ISML conditional tags
Hard-coded logic that requires deployment for updates. Not merchant-friendly and violates maintainability goals.

C. Service Profile
Service Profiles are used for external integrations, such as SOAP/REST calls, not for rendering or storing HTML snippets.

🔗 Reference:
“Site preferences allow developers to define configurable settings accessible via Business Manager. HTML-type preferences are ideal for storing markup or third-party tracking code.” — Salesforce B2C Commerce | Developer Guide
📖 Site Preference Configuration
Question 39 Choose 1
A client has a requirement to allow users on the Storefront to filter by a newly created attribute.
After creating the search refinement, what else is necessary to achieve this?
Show answerHide answer

Correct answer: A Ensurethe attribute has data and is indexed

Explanation

Explanation:

After creating a search refinement definition (to allow filtering by a new product attribute on the Storefront), you must ensure that:

The attribute contains actual data in the product catalog
The attribute is indexed in the search index
This makes it available to be used for refinements (faceted search) on the storefront

Even if you create the refinement configuration in Business Manager, it won’t work unless the attribute is indexed and populated.

🔧 Steps to Achieve Filtering on a New Attribute:
✅ Create the attribute in the product system object (if not already present).
✅ Populate the attribute with values for the appropriate products.
✅ Configure it as searchable and refinable in Business Manager:
Go to Merchant Tools → Search → Searchable Attributes
Set:
Searchable = true (if you want to search by it)
Use in Search Refinements = true (to enable filter)
✅ Rebuild the search index so the changes take effect.
✅ Verify in storefront: You should see the new refinement appear in the product listing page sidebar.

❌ Why the Other Options Are Incorrect:
B. Set the attribute as Searchable
This is necessary only if you want the attribute to be searchable, but not sufficient alone to make it refinable. Also, indexing is still required.
C. Change productsearchrefinebar.isml
The SFRA template already supports dynamic refinements. You don’t need to change the ISML unless you’re customizing layout or display.

📘 Reference:
Searchable Attributes & Refinements
Indexing Product Attributes for Search
Question 40 Choose 1
A developer wants to configure multiple products that should only be sold as a group. It should not be possible for buyers to buy these products individually. How should the developer configure the products?
Show answerHide answer

Correct answer: A Bundle

Explanation

Explanation

Salesforce B2C Commerce Product Grouping Options
Salesforce B2C Commerce offers three primary ways to group products: Sets, Bundles, and Variation Groups. The choice between them depends entirely on the business requirement regarding inventory and purchasing behavior.

Understanding the Bundle
A Product Bundle is the correct configuration when multiple products must be sold together as a single unit. In a bundle, the parent product has its own unique ID, but it is composed of several child products. For this requirement, a merchant can configure the storefront so that these items are only purchasable through the bundle. While the individual components can exist in the catalog, the bundle allows them to be added to the cart as a single line item with a single price, which can be different from the sum of the individual products.

Inventory and Price Logic
The inventory of a bundle depends on the availability of its components. If one item in the bundle is out of stock, the entire bundle becomes unorderable. This behavior ensures the group remains intact. From a pricing perspective, the bundle can have its own price, enabling bundled or kit discounts that are not available when purchasing items separately.

Why Sets and Variations Don't Fit
A Product Set is a loose collection of products. On a product set page, a shopper can choose to add individual items from the set or add the entire set. It does not restrict customers from purchasing items individually, which does not meet the requirement.

A Variation Group is used to group products that share a common attribute, such as color or size variations under a master product. It is not intended for combining different types of products (for example, a camera, bag, and lens) into a single mandatory purchasable unit.

References
Salesforce B2C Commerce Help: Product Bundles, Sets, and Variations
Trailhead: Explore Product Types in B2C Commerce
Full mock exam

Sit the Salesforce-B2C-Commerce-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real Salesforce-B2C-Commerce-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full Salesforce-B2C-Commerce-Developer mock exam
  • —questions per mock
  • —time limit
  • 154questions in the bank
  • Newmock on every attempt