Salesforce-B2C-Commerce-Cloud-Developer Practice Test

Salesforce Spring 25 Release -
Updated On 1-Jan-2026

202 Questions

A developer plans to use the /search_suggestion (Shop API) in a Storefront application and the following property must be set to do so
suggestion.product.image:view_type
What consideration should the developer in keepin mind to ensure that image data is returned correctly as part of search suggestions?

A. If the view_type is not set or if the view_type is unknown, the image properties are not part of the response.

B. If the view_type is not set or if the view_type is unknown, the image size of 'small' is used by default

C. If the view_type is not set or if theview_type is unknown, the image size of 'large' is used by default

A.   If the view_type is not set or if the view_type is unknown, the image properties are not part of the response.

Explanation:

Key Consideration for suggestion.product.image:view_type:
The view_type property determines which image size/type is returned in search suggestions (e.g., small, medium, large).

If view_type is missing or invalid:
No image data is included in the API response.
This ensures the API doesn’t return incorrect or unintended image sizes.

Why Not Other Options?
❌ B. Defaults to 'small'
Incorrect. The API does not fall back to a default size.

❌ C. Defaults to 'large'
Incorrect. Same as above—no default is applied.

Reference:
OCAPI Search Suggestions Documentation

In order to implement site custom functionality, a developer creates a new cartridge.
Which step should the developer take to ensure their cartridge changes take effect?

A. Add the new cartridge to the cartridge path for the business Manager site.

B. Rebuild the site indexes to capture incremental changes.

C. Add the new cartridge to the cartridge path for the relevant Storefront site.

C.   Add the new cartridge to the cartridge path for the relevant Storefront site.

Explanation:

In Salesforce B2C Commerce, if a developer creates a new cartridge to implement custom functionality (controllers, scripts, templates, etc.), the only way to activate it is to include it in the cartridge path of the Storefront site that will use it.

🔹 Steps to Apply Cartridge Changes:
Go to:
Administration → Sites → Manage Sites → [Your Site] → Settings
Edit the cartridge path and prepend your new cartridge:
Example:
app_custom_mycartridge:int_custom:int_paypal:app_storefront_base
Save changes

Why the Other Options Are Incorrect:

A. Add the new cartridge to the Business Manager site
❌ That’s only relevant for cartridges that modify Business Manager modules, not storefront behavior
B. Rebuild site indexes
❌ Indexes affect search/catalog visibility, not cartridge code activation

🧠 Tip:
Cartridge order matters:
The first cartridge found in the path with a matching file takes precedence.
Always place your custom cartridges before base ones like app_storefront_base if you intend to override or extend functionality.

🔹 Reference:
📘 Salesforce B2C Commerce Documentation
Reference:
Salesforce B2C Commerce – Add a Cartridge to a Site

Quote:
"To use functionality from a cartridge in a site, the cartridge must be added to the cartridge path for that site. The order in which cartridges appear in the path determines which resources are used when multiple cartridges contain the same resource."

A developer wants to configure the following products so that same search results ire returned regardless of the search term used. The search term can be bag, purse, pocketbook, and tote. Mow should the developer configure this?

A. Synonyms

B. Hypernyms

C. Hyponyms

A.   Synonyms

Explanation:

Why Synonyms Enable Unified Search Results
In Salesforce B2C Commerce, when a merchant wants different customer search terms to return the same product results, they use the Synonym Dictionary under the search configuration.

🔄 Example Use Case
For the terms:
Bag
Purse
Pocketbook
Tote

You want customers using any of these to get identical search results. This is a textbook case for defining a synonym group.

Synonyms
Synonyms allow the search index to treat multiple terms as equivalent.
You define a group like:
bag = purse = pocketbook = tote
No matter which term the shopper uses, they'll receive results mapped to all members of the synonym group.

Why Hypernyms and Hyponyms Are Incorrect

Hypernyms
Generalizations (e.g. "accessory" is a hypernym for "bag") Would broaden the result scope — not helpful if you want consistent, targeted results
Hyponyms
Sub-categories (e.g. "clutch" or "satchel" under "bag") Too specific — would lead to inconsistent results if only one hyponym is matched

🔗 Reference:
“Use synonym mappings to ensure uniform search behavior for related words or interchangeable terms. This improves usability and customer satisfaction.” — Salesforce B2C Commerce | Search Configuration Guide
📖 Synonym Dictionary Documentation

A developer has a sandbox with code to log a message during execution, and the following code:



After the code executes, the developer does not see any log file with the message in the WebDAV folder. What could the developer do tocorrect this issue?

A. Set the root log level to debug AND check the box for info under Log Files.

B. Set the logging global preference to true AND set the root log level to debug.

C. Set the logging global preference to true AND check the box for Info under Log Files

C.   Set the logging global preference to true AND check the box for Info under Log Files

Explanation:

Key Issue:
The Logger.info(message) call isn’t generating log files in WebDAV.
Two critical settings must be configured for logs to appear:

Solution (Option C):
1. Enable Global Logging Preference
Navigate to Administration > Operations > Logging Preferences in Business Manager.
Set "Enable Logging" to true.

2. Enable "Info" Log Level in Log Files
In the same Logging Preferences section:
Under "Log Files", check the box for "Info".
This ensures Logger.info() calls are captured.

Why Not Other Options?
❌ A. Root log level to debug + Info checkbox
While enabling "Info" logging is correct, debug level is unnecessary for Logger.info() to work.

❌ B. Global preference + debug level
Debug level is overkill, and missing the "Info" checkbox is the core issue.

Reference:
Salesforce Logging Configuration

A developer is asked to create a new service instance that will call a remote web service.
Which method should the developer use to create the service instance?

A. Option A

B. Option B

C. Option C

A.   Option A

Explanation:

In Salesforce B2C Commerce, when a developer needs to call a remote web service, they define and manage the service using the Service Framework. The recommended and standard method to create or register a service instance is:

dw.svc.LocalServiceRegistry.createService(serviceID, definitionObject)

This method registers a new service dynamically in code by associating a service ID (defined in Business Manager) with a JavaScript implementation object that provides:
createRequest
parseResponse
mockCall (for testing)
getRequestLogMessage
getResponseLogMessage

🔧 Example:
var LocalServiceRegistry = require('dw/svc/LocalServiceRegistry');
var myService = LocalServiceRegistry.createService('my.http.service', {
createRequest: function(svc, params) {
svc.setRequestMethod('GET');
return null;
},
parseResponse: function(svc, response) {
return response.text;
}
});

Then call it like:
var result = myService.call();

Why Other Options Are Incorrect:

B. dw.svc.LocalServiceInstance.createService()
❌ Invalid class — there is no LocalServiceInstance in the SFCC Service Framework

C. dw.svc.LocalServiceRegistry.getDefaultService()
❌ This is for retrieving a default, already-registered service — not for creating one

📘 Reference:
Salesforce B2C Commerce Service Framework Docs

Salesforce-B2C-Commerce-Cloud-Developer Exam Questions - Home Previous
Page 3 out of 41 Pages