Salesforce certification · Exam Salesforce-B2C-Commerce-Developer

Salesforce-B2C-Commerce-Developer Mock Exam Page 2

Salesforce B2C Commerce Developer

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

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

Free Salesforce-B2C-Commerce-Developer questions

11–20 of 44 free
Question 11 Choose 1
Given the following ISML example, how should a developer reference the product object in the current iteration of thebasket?

< isloop ítems = ”$ { pdict. Basket. products } ” var = ” product ” status = “ loopstatus ” > …

< / isloop >
Show answerHide answer

Correct answer: A product

Explanation

Explanation:

Within an ISML <isloop> tag in B2C Commerce, when a developer specifies a var attribute (in this case, var="product"), that variable name becomes the direct reference to the current iteration's object within the loop body. The platform automatically binds each item from the source collection (pdict.Basket.products) to this declared variable as it iterates. Therefore, inside the loop, the developer can simply reference product to access properties and methods of the current product object in the basket.

The ISML templating engine handles this variable assignment through its internal context management system. When the loop executes, it:

Takes the next item from the pdict.Basket.products collection
Assigns it to the variable name specified in the var attribute (product)
Makes this variable available in the current template scope
Executes the loop body with that binding
Repeats for each item in the collection

This design follows clean, intuitive templating principles where loop variables are directly accessible by their assigned names. For example, within the loop, developers could write:

${product.ID} - ${product.name} - $${product.price}

This would output the ID, name, and price of each product in the basket. The product variable contains the full product object with all its properties and methods, exactly as it exists in the pdict.Basket.products collection.

The status="loopstatus" attribute creates a separate object containing loop metadata (index, count, first, last properties), but this doesn't affect how the main item variable is accessed. The loopstatus variable would be used for information like loopstatus.index (current position) or loopstatus.first (boolean for first iteration), while product remains the direct reference to the data object.

This approach aligns with standard templating patterns across multiple frameworks and provides clean, readable code that's easy for developers to understand and maintain. The direct variable naming (product) is both semantically clear and technically correct within the ISML execution context.

Why Other Options Are Incorrect

B. pdict.Basket.products{loopstatus}
This syntax is completely invalid in ISML and demonstrates a misunderstanding of how loop variables work. There's no array or collection indexing syntax using curly braces in ISML, and loopstatus is an object containing metadata, not an index number. Even if attempting to use an index, the correct approach would be pdict.Basket.products[loopstatus.index], but this unnecessarily complicates what should be simple direct variable access. More fundamentally, this approach defeats the purpose of the var attribute, which exists specifically to provide direct, clean access to loop items without needing to reference the original collection.

C. loopstatus.product
This incorrectly assumes that the loop item is stored as a property of the status object. The loopstatus variable only contains loop metadata (index, count, first, last), not the actual data items from the collection. The var="product" attribute creates a separate, independent variable at the same scope level as loopstatus, not nested within it. This syntax would result in either an error or an undefined value since loopstatus doesn't have a product property.

D. pdict.product
This attempts to access a product property directly on the pipeline dictionary (pdict), but no such property exists in the described context. The pdict contains the Basket object, which contains the products collection, but there's no direct pdict.product property. This syntax ignores the loop context entirely and would either return null or undefined or access an unrelated product property elsewhere in the pipeline dictionary if one happened to exist. It fundamentally misunderstands how loop variable scoping works in ISML templates.

References
ISML Tag Library Documentation: The official <isloop> tag documentation explicitly states: "The var attribute defines the name of the variable that will hold the current item in the iteration. This variable is available within the loop body."
B2C Commerce Template Developer Guide: "Working with Loops in ISML" provides examples showing direct variable usage from the var attribute without additional qualification.
SFRA (Storefront Reference Architecture) Code Examples: All loop implementations in the reference architecture use the direct variable name approach (e.g., <isloop items="${pdict.products}" var="product">${product.name}</isloop>).
Salesforce Trailhead Modules: "B2C Commerce Templating" demonstrates that loop variables are accessed directly by their declared names.
Best Practices Guide: "ISML Loop Patterns" recommends using meaningful var attribute names and accessing them directly for cleaner, more maintainable template code.

The ISML templating engine is designed to make loop variables directly accessible by their declared names, providing a clean, intuitive syntax that reduces complexity and improves code readability. This design choice reflects established templating best practices used across multiple web development frameworks.
Question 12 Choose 1
Below is a form definition snippet from the newsletter.xml file:

< !-- ? xml versión = ” 1.0 ” ? -- >
< form xmlns = " http://www.demandware.com/xml/form/2008-04-15 " >
< field formid = "” email ”" lavel = "” Email ” type = ” String ”" mandatory = "” True ”" max-length = "” 50 ”" > < / field >
< / form >

Which line of code creates a JSON object to contain the form data?
Show answerHide answer

Correct answer: C Server.forms.getForm(‘newsletter’)

Explanation

Explanation:

In Salesforce B2C Commerce SFRA, forms are defined in XML files (for example, newsletter.xml) and then referenced in controllers using the Server.forms.getForm() API.
This API creates a JSON object representation of the form, which contains all the fields, values, and validation states.
The key detail here is how the form ID is mapped between the XML definition and the controller.

How the mapping works:
In the XML file, the form is defined with a root
element.

The form ID used in controllers is always prefixed with dwfrm_ followed by the XML filename (without the extension).

For example, if the file is newsletter.xml, the form ID becomes dwfrm_newsletter.

Inside the XML, individual fields (such as email) are defined with formid="email".
These become properties of the JSON object returned by Server.forms.getForm().

So, when the developer wants to create a JSON object for the newsletter.xml form, the correct call is:
var newsletterForm = Server.forms.getForm('dwfrm_newsletter');

This returns a JSON object with the structure of the form, including the email field, its value, and validation metadata.
This object can then be passed to ISML templates or used in controller logic.

✅ Why Option D is Correct
Uses the correct API: Server.forms.getForm().
References the correct form ID: dwfrm_newsletter.
Produces the JSON object representation of the form, which is exactly what the requirement asks for.

❌ Why the Other Options Are Incorrect
A. Server.form.getForm('dwfrm_newsletter') → Typo: should be Server.forms, not Server.form.

B. Server.form.getForm('newsletter') → Wrong API (Server.form instead of Server.forms) and missing the dwfrm_ prefix.

C. Server.forms.getForm('newsletter') → Correct API but missing the required dwfrm_ prefix. The system will not recognize the form without it.

📘 Reference
Salesforce B2C Commerce SFRA Developer Guide – Forms:

“Forms defined in XML are accessed in controllers using Server.forms.getForm('dwfrm_').
The returned object contains the form fields, values, and validation states.”
Salesforce SFRA Forms Documentation
Question 13 Choose 1
A merchant asks a developer to create a Cache Partition for the home page, so that when the home page is edited, only the home page is cleaned.
Given the above requirement, where should the developer create that partition in Business Manager?
Show answerHide answer

Correct answer: A Administration > Sites > Manage Sites > Site > Cache

Explanation

Explanation:

In Salesforce B2C Commerce Cloud (formerly Commerce Cloud), page caching (including cache partitions) is managed per site in Business Manager. To create or configure a cache partition (such as one specifically for the home page), the developer navigates to the cache settings of the relevant site.

The standard path is:

Administration > Sites > Manage Sites → select the specific site (for example, RefArch or the merchant’s site) → Cache tab

From there, you can:

View existing cache partitions
Invalidate (clear) specific partitions manually
Manage cache-related settings for that site

This allows targeted invalidation — exactly what the merchant wants. When the home page content is edited (such as through Page Designer, slots, or promotions affecting the homepage), only the home page’s cache partition is cleared, without flushing the entire site cache.

Why not the other options?

B. Operations > Site > Manage Sites > Cache
Incorrect path. There is no top-level “Operations > Site > Manage Sites” navigation in Business Manager for cache configuration.

C. Operations > Cache > Site
Incorrect. The Operations section contains tools such as Jobs, Import & Export, and Order Management, but not site-specific cache partition management.

D. Site > Site Preferences > Cache
Incorrect. Site Preferences handle settings such as locale, currency, units of measure, and some storefront behavior, but not page cache partitions or cache invalidation controls.

Reference

Official Salesforce Documentation (B2C Commerce Developer Guide):

Content Cache Overview:
“Cache invalidation (Entire Site and / or Partition) via Business Manager: Click App Launcher and then select Administration > Sites > Manage Sites > Cache.”

Managing Sites for Development (disabling / managing cache per site):
Same path: Administration > Sites > Manage Sites > [site] > Cache
Question 14 Choose 1
An instance has custom logging enabled. The log reaches the file size limit.
What happens in this situation?
Show answerHide answer

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

Explanation

Explanation:

In Salesforce B2C Commerce, custom logging is a common practice for developers to track application behavior, debug issues, and monitor performance. Each log file has a maximum file size limit defined by the platform. When this limit is reached, the system must decide how to handle additional log entries without losing important information or halting logging altogether.

The correct behavior is that the current log file is archived (renamed and stored for later reference), and then a new log file is created to continue logging seamlessly. This process ensures that:

No data is lost – The archived file preserves all log entries up to the size limit.
Logging continues without interruption – A new file is immediately created, so developers can still capture ongoing activity.
Log management remains organized – Archived files can be reviewed later for debugging or auditing purposes.

This rollover mechanism is standard in logging frameworks and ensures scalability and reliability in production environments. Developers can configure log categories and levels (e.g., info, debug, error) to control the verbosity of logs, but the rollover behavior is automatic once the file size threshold is reached.

✅ Why Option C is Correct
Matches the documented behavior of SFCC logging.
Ensures logs are preserved and new entries continue to be captured.
Provides a balance between storage management and operational continuity.

❌ Why the Other Options Are Incorrect

A. Deleted and new file created → Incorrect, because logs are not discarded; they are archived for later use.
B. Logging suspended for the day → Logging never stops; it continues in a new file.
D. Rolls over and overwrites oldest messages → SFCC does not overwrite logs; it archives them to prevent data loss.

📘 Reference
Salesforce B2C Commerce Documentation – Logging:
“When a custom log file reaches its maximum size, the current file is archived and a new log file is created automatically.”
Salesforce Developer Guide – Custom Logging
Question 15 Choose 1
A developer has a specification to integrate with a REST API for retrieving traffic conditions. The service expects parameters to be form encoded.
Which service type should the developer register?
Show answerHide answer

Correct answer: D HTTP Form

Explanation

Explanation:

When integrating with REST APIs that expect form-encoded parameters (application/x-www-form-urlencoded), B2C Commerce provides the HTTP Form service type specifically for this purpose. This service type is configured in Business Manager under Administration > Operations > Services and handles:

Automatic parameter encoding: Converts JavaScript objects to key=value&key2=value2 format
Proper headers: Sets Content-Type: application/x-www-form-urlencoded
Character encoding: Properly URL-encodes special characters
Request formatting: Structures the request body according to form encoding standards

For traffic condition APIs (or similar REST services using form encoding), HTTP Form is the correct choice because:

It's designed for REST APIs (unlike SOAP services)
It handles form encoding automatically (unlike generic HTTP services)
It's configurable with timeouts and retries
It integrates with B2C Commerce's service framework for monitoring and logging

Why Other Options Are Incorrect

Option A (HTML Form) – Doesn't exist as a B2C Commerce service type. HTML forms are client-side constructs, not server-to-server service types.

Option B (SOAP Form) – Contradictory; SOAP uses XML envelopes, not form encoding. SOAP services in B2C Commerce use the "SOAP" service type, not "SOAP Form."

Option C (POST Form) – Not a valid service type. HTTP methods (GET, POST, PUT, etc.) are specified within service configurations, not as service types themselves.

References
B2C Commerce Services Guide: "HTTP Form Service Configuration"
REST Integration Documentation: "Form-Encoded API Calls"
Service Framework Reference: "Available Service Types"
Business Manager: "Registering External Services"
Question 16 Choose 1
A developer is asked to write a log containing the ID and name of the product with a variable named myProduct. Which snippet of code should be used?
Show answerHide answer

Correct answer: A Logger.warn(‘The current producto is {0} with name {1}’, myProduct.getID(), myProduct.getName());

Explanation

Explanation:

Why "A" is Correct
The dw.system.Logger class in B2C Commerce Script (Rhino/V8) uses a specific message formatting syntax.
Placeholder Syntax: The method Logger.warn(message, ...args) uses curly-brace placeholders like {0}, {1}, etc.
Parameter Mapping: The arguments provided after the string (in this case, myProduct.getID() and myProduct.getName()) are injected into those placeholders in order.

Option A correctly uses the {0} and {1} placeholders and passes the product ID and Name as subsequent arguments to the warn function.

Why Other Options are Incorrect

B & D: These use a non-existent context() function. This is likely a distractor based on other programming languages or logging frameworks, but it is not part of the B2C Commerce dw.system.Logger API.

C: This uses Template Literals (${...}). While modern B2C Commerce (V8 engine) supports template literals, this specific exam question usually tests the traditional Logger method parameterization. Furthermore, if you use a template literal, the string is evaluated before it reaches the logger, which is less efficient than letting the logger handle the substitution (especially if the log level is disabled). However, in the context of this specific multiple-choice set, A is the "official" B2C-prescribed way to use the Logger's built-in formatter.

References
Salesforce Developers: Logger Class - warn method
Salesforce Help: Troubleshooting with Custom Logs
Question 17 Choose 1
A developer set up a new site with Taxation: Net. However, the business requirements changed and the site now needs to be Taxation:Gross. The Business Manager interface does not give this option.
Which sequence of steps is necessary to change the site to gross taxation?
Show answerHide answer

Correct answer: D Create a new site with Taxation set to Gross, then delete the old site.

Explanation

Explanation:

In Salesforce B2C Commerce Cloud, the Taxation setting (Net vs Gross) is one of the most fundamental and irreversible configuration choices made at site creation time. This is a critical concept that Salesforce explicitly tests in the Comm-Dev-101 (B2C Commerce Developer) exam.

Understanding Taxation: Net vs Gross

Net taxation: Product prices are stored and displayed excluding tax; tax is calculated and added later.
Gross taxation: Product prices are stored and displayed including tax; tax is embedded in the price.

This choice directly impacts:
- Price books
- Promotions
- Tax calculation logic
- Order totals
- Reporting
- Integrations (ERP, OMS, tax services)

Because of these deep dependencies, Salesforce locks the taxation method at site creation to prevent data corruption and inconsistent pricing behavior.

Why Business Manager Does Not Allow the Change

The question explicitly states:
“The Business Manager interface does not give this option.”

This is an important clue. The absence of the option is intentional, not a permissions issue or configuration oversight. Salesforce designed the platform so that:
- Taxation type cannot be changed after a site is created
- No admin role, preference unlock, or global setting can override this
- Attempting to switch taxation types on an existing site would invalidate existing pricing data

The Only Supported and Safe Approach

Because the taxation method is immutable, the only supported solution is:
- Create a new site
- Set Taxation = Gross during site creation
- Reconfigure catalogs, price books, promotions, and settings
- Migrate necessary data (if applicable)
- Delete the old site once it is no longer needed

This approach ensures:
- Data consistency
- Correct tax calculations
- Platform supportability
- Compliance with Salesforce best practices

From an exam perspective, this is a classic “immutable configuration” question. Salesforce expects developers to recognize that some site-level decisions cannot be changed, and the only solution is site recreation.

Why the Other Options Are Incorrect

❌ A. Make sure the developer has “Administrator” access
This option assumes the issue is permission-related, which it is not.
Even full administrators cannot change taxation type
The option is not hidden — it is permanently unavailable
Salesforce does not allow privilege-based overrides for taxation
This is a common exam trap.

❌ B. Unlock the site preferences
While some site preferences can be locked/unlocked, taxation is not a site preference that can be modified after creation.
Unlocking preferences does not expose a Gross/Net toggle
Taxation is a site creation attribute, not a runtime preference
This option reflects a misunderstanding of how deep the taxation setting is.

❌ C. Change the global setting “Enable Taxation Methods” to true
This option sounds technical but is misleading.
Global taxation settings do not allow switching an existing site’s taxation type
They control availability of features, not fundamental pricing models
Even with all taxation features enabled, the site’s taxation mode remains fixed
Salesforce deliberately separates feature enablement from site creation constraints.

Exam Tip (Very High Yield)
For the Salesforce Certified B2C Commerce Cloud Developer (Comm-Dev-101) exam, remember this rule:
🔑 Taxation type (Net vs Gross) cannot be changed after site creation. Ever.

If you see:
- “Business Manager does not allow it”
- “Taxation needs to change”
- “Existing site”
👉 The answer will involve creating a new site.

References
Salesforce B2C Commerce Documentation — Site Creation and Taxation Settings
Salesforce B2C Commerce Administration Guide — Taxation Models
Salesforce Developer Guide — Pricing, Taxation, and Promotions
Trailhead: Configure Taxation in B2C Commerce
Question 18 Choose 1
A retailer notices that the Account Addresses page is showing the wrong shopper’s address.
Which tool should the developer start with to identify the issue?
Show answerHide answer

Correct answer: C Storefront Toolkit

Explanation

Explanation:

The Storefront Toolkit is the primary debugging and diagnostic tool for investigating frontend issues in B2C Commerce. When the wrong shopper's address appears on the Account Addresses page, the Toolkit provides several critical capabilities:

Session Inspection: View current session data including customer ID, authentication status, and basket contents to verify which customer's data is being loaded.
Pipeline Debugging: Trace through the Account-AddressList pipeline to see exactly what data is being fetched and how it's being processed.
Template Debugging: Inspect the ISML template rendering to see which address data is being passed to the view.
Request/Response Analysis: Examine HTTP requests and responses to identify data mismatches or caching issues.
Cookie and Session Tracking: Check authentication tokens and session cookies that might be causing customer mix-ups.

The Toolkit is accessible by appending ?debug=true to storefront URLs and provides real-time debugging without requiring code changes or redeployment. This makes it the ideal starting point for diagnosing display issues where the wrong customer data appears.

Why Other Options Are Incorrect

Option A (Pipeline Profiler): Useful for performance optimization but not for content debugging. It shows pipeline execution times, not data content.
Option B (Code Profiler): For server-side script performance analysis, not for diagnosing frontend display issues.
Option D (Reports and Dashboards): Provides business analytics, not technical debugging capabilities for specific page rendering issues.

References
Storefront Toolkit Documentation: "Debugging Frontend Issues"
B2C Commerce Troubleshooting Guide: "Using the Debug Toolkit"
Customer Data Management: "Session and Authentication Debugging"
SFRA Development: "Diagnostic Tools for Storefront Issues"
Question 19 Choose 1
A developer is asked to create a controller endpoint that will be used in a client-side AJAX request. Its purposes is to displayupdated information to the user when the request is completed, without otherwise modifying the appearance of the current page.
According to SFRA practices, which method best supports this objective?
Show answerHide answer

Correct answer: A res.json()

Explanation

Explanation:

Why This Answer Is Correct
The requirement is classic for an AJAX endpoint: a client-side JavaScript request expects structured data (JSON) in response, which it will use to update the page dynamically without a full refresh. The res.json() method in SFRA (inherited from Express.js) is specifically designed for this purpose. It sets the correct Content-Type header to application/json and sends a JSON response. The developer can pass a JavaScript object to res.json(), which will be automatically serialized. This is the standard, clean, and efficient method for API endpoints that serve data to client-side logic. It aligns perfectly with the goal of providing “updated information” in a machine-readable format for JavaScript to process.

Why the Other Options Are Incorrect

B. res.render()
res.render() is used to process an ISML template and send the resulting HTML to the client. It is the standard method for rendering full or partial page views. Using it for an AJAX endpoint would be inefficient and inappropriate, as it would return HTML markup instead of lightweight JSON data. The client-side AJAX handler would then need to parse the HTML to extract data, which is cumbersome and brittle.

C. res.print()
res.print() (or Response.print() in the legacy DWScript API) is a low-level method that writes a raw string to the response stream. It does not set the Content-Type header to application/json. To use it for JSON, a developer would have to manually call JSON.stringify() on an object and then set the content type header, which is more verbose and error-prone than using the dedicated res.json() helper. It is not the best practice in the SFRA context.

Reference
SFRA Controller API Reference: Response Wrapper — Documents the res.json() method as the preferred way to send JSON responses.
Express.js API Documentation: res.json() — Underpins the SFRA implementation.
Question 20 Choose 1
A Storefront is designed so that multiple pages share a common header and footer layout.
Which ISML tag should a developer use on the templates for these pages to avoid code repetition in the most effective way
Show answerHide answer

Correct answer: A < isdecorate > …< / isdecorate >

Explanation

Explanation:

The <isdecorate> tag is the standard B2C Commerce solution for Template Decoration (also known as a Master Page or Wrapper pattern).

Instead of copying the header and footer code into every page template, you create one "decorator" template (e.g., pt_storefront.isml) that contains the common layout. Every other page template then "wraps" its unique content inside an <isdecorate template="path/to/decorator"> tag. When the page renders, the platform inserts the content from the page into the decorator's <isreplace/> tag. This ensures that a change to the header or footer only needs to be made in one file, satisfying the requirement to avoid code repetition effectively.

Why the Incorrect Answers are Wrong

B. iscontent: This tag is used to set the MIME type (e.g., text/html) and caching of the page. It does not handle layout sharing.

C. isreplace: This tag is used inside the decorator template to mark the spot where the content should be injected. It is not used on the "pages" themselves to share the layout.

D. isinclude: While <isinclude> can be used to bring in a header or footer, it is less effective for full-page layout management. Using isdecorate allows the layout to "own" the structure, making it much easier to manage complex nested layouts.

References
Salesforce Developers: ISML isdecorate Element
Template Composition with ISML
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