Salesforce-B2C-Commerce-Cloud-Developer Practice Test Questions

Total 202 Questions


Last Updated On : 16-Jul-2025



Preparing with Salesforce-B2C-Commerce-Cloud-Developer practice test is essential to ensure success on the exam. This Salesforce SP25 test allows you to familiarize yourself with the Salesforce-B2C-Commerce-Cloud-Developer exam questions format and identify your strengths and weaknesses. By practicing thoroughly, you can maximize your chances of passing the Salesforce certification spring 2025 release exam on your first attempt.

Surveys from different platforms and user-reported pass rates suggest Salesforce-B2C-Commerce-Cloud-Developer practice exam users are ~30-40% more likely to pass.

A client sells its product in single-brand stores as well as in multi-brand stores. When shown in the store locator list, the client wants the single-brand stores to have a particular background color to highlight them.
Which Business Manager action should be completed to allow the developer to apply different styling to the single-brand stores?



A. Add a Boolean custom attribute to the Store system object


B. Configure the existing Store custom object type definition


C. Create a new SingleBrandStore custom object configuration


D. Adjust the relevant Site Preference in the Stores group





A.
  Add a Boolean custom attribute to the Store system object

Explanation:

Why This Works:
The Store system object already contains core attributes (e.g., name, address). Adding a Boolean custom attribute (e.g., isSingleBrandStore) allows developers to:

Flag single-brand stores in Business Manager.

Apply conditional CSS in the store locator template (e.g., {% if store.custom.isSingleBrandStore %} background-color: #ffeb3b; {% endif %}).

Implementation Steps:

In Business Manager:
Administration > Sites > Stores > Store Attributes > Add Custom Attribute
Name: isSingleBrandStore
Type: Boolean
In Store Locator Template:
< div class = " store " style = " { % if store.custom . is SingleBrandStore % } background - color : yellow ; { % endif % } " >
{{store.name}}


Why Other Options Are Incorrect:

B (Configure Store custom object type): Overcomplicates the solution—custom objects are for new data structures, not extending existing ones.

C (Create SingleBrandStore custom object): Unnecessary; stores already exist as system objects.

D (Site Preference): Site Preferences are global settings, not store-specific.

A developer is given a task to implement a new Page Designer layout component that doesn’t accept certain asset components.How should the developer achieve the above task?



A. Add component_type_inclusion in the layout json configuration


B. Add component_type_Exclusions in the layout json configuration


C. Add layout_type_inclusion in the target components json configurations.


D. Add layout_type_exclusion in the other asset components json configuration





B.
  Add component_type_Exclusions in the layout json configuration

Explanation:

In Salesforce B2C Commerce Page Designer, when you want a layout component to exclude specific asset components, you define that restriction in the layout’s meta definition JSON file using the component_type_Exclusions property.

This tells Page Designer:

“This layout should not allow these component types to be dropped into its regions.”

It enforces design constraints and prevents merchandisers from accidentally using incompatible or undesired components.

For example:
{
"component_type_Exclusions": ["asset-banner", "asset-carousel"]
}

This would prevent those asset components from being used in the layout.

Why the other options don’t work:

A. component_type_inclusion: This is not a valid property in layout configuration — inclusion is handled differently.

C. layout_type_inclusion in component JSON: That controls where a component can be used, not what a layout accepts.

D. layout_type_exclusion in asset component JSON: Again, this restricts where a component can be placed, not what a layout allows.

Universal Containers needs to have Apple Pay disabled for the country of Spain.
Which Business Manager module should the Developer use to meet this requirement?



A. Merchant Tools > Ordering > Payment Methods


B. Merchant Tools > Site Preferences > Apple Pay


C. Merchant Tools > Ordering > Payment Processors


D. Merchant Tools > Site Preferences > Payment Types





A.
  Merchant Tools > Ordering > Payment Methods

Explanation:

Why This Module?
Payment Methods in Business Manager allows you to enable/disable payment options (like Apple Pay) per country.

Steps:
Merchant Tools > Ordering > Payment Methods > Apple Pay > Disable for Spain

Why Not Other Options?

B (Site Preferences > Apple Pay): No such path exists—Apple Pay is configured under Payment Methods.

C (Payment Processors): Manages processors (e.g., Adyen), not country-specific payment visibility.

D (Site Preferences > Payment Types): Incorrect—this controls general settings, not country-level toggles.

Universal Containers recently completed updates to their storefront shopping cart page. A problem has been discovered since the update. Users are no longer able to submit coupon codes on this page. Additionally, authenticated userswho try to add a coupon are logged out.
The following processing code is found in the Cart.js controller file:



What should the Developer verify to identify the issue?



A. The CSRF cartridge is included in the site’s cartridge path


B. The form group has the secure attribute set to true


C. The CSRF token is present in the form and is being submitted in the request.


D. The CSRF settings in Business Manager are properly configured.





C.
  The CSRF token is present in the form and is being submitted in the request.

Explanation:

The symptoms described point clearly to a CSRF (Cross-Site Request Forgery) protection failure:

Coupon form fails to submit
Authenticated users are logged out when submitting the form

This is a common result of missing or invalid CSRF tokens. In SFRA (Salesforce Reference Architecture), CSRF protection is enabled by default on forms that use POST, and failure to validate a CSRF token will cause:

Form submission to be rejected
Session to be invalidated (causing logout)

What to Verify:
You should inspect the ISML template that renders the coupon submission form and ensure it includes this hidden input:

This injects the valid CSRF token into the form using the csrf object available in the pipeline dictionary.

Why Other Options Are Incorrect:

A. The CSRF cartridge is included in the site’s cartridge path
➤ CSRF isn’t a standalone cartridge — it’s a middleware provided in SFRA, not a separate cartridge.

B. The form group has the secure attribute set to true
➤ secure="true" ensures the form is submitted via HTTPS, but does not affect CSRF handling.

D. The CSRF settings in Business Manager are properly configured
➤ CSRF settings in BM are rarely the cause — they only define global enforcement, and won’t override missing token logic in your ISML or controller.

A Digital Developer suspects a logical error in a script.
Which action will help locate the error?



A. Submit a support ticket to B2C Commerce.


B. Check request logs for evidence of the logical error.


C. Put breakpoints in the code, debug, and examine variable values.


D. Print all values in the script node called before the current script.





C.
  Put breakpoints in the code, debug, and examine variable values.

Explanation:

When a logical error is suspected in a Salesforce B2C Commerce script, the most effective way to locate and understand the issue is to:

Use the Script Debugger (available in sandbox environments).

Set breakpoints at key lines of code.

Step through execution to observe control flow and variable values.

Evaluate expressions to confirm whether logic behaves as expected.

This approach allows the developer to pinpoint exactly where the logic deviates from expectations — whether due to incorrect conditions, unexpected data, or flawed assumptions.

Why the other options fall short:

A. Submit a support ticket: Support can help with platform issues, but not with custom logic bugs in your code.

B. Check request logs: Useful for runtime errors or stack traces, but not ideal for tracing logic flow.

D. Print values in a previous script node: May help in pipelines, but doesn’t offer the precision or control of a debugger.

A Digital Developer is adding support for an additional language other than the default. The locale code for the new language is de.
In which folder should the developer place resource bundles?



A. templates/de


B. templates/default


C. templates/resources


D. templates/default/resources





D.
  templates/default/resources

Explanation:

In Salesforce B2C Commerce, resource bundles (like checkout.properties, account.properties, etc.) are used to localize text displayed in ISML templates. These bundles must be placed in the correct folder structure to support locale-specific overrides.

To support a new language with locale code de (German), the developer should:

Place the default resource bundle in: templates/default/resources/checkout.properties

Then, add a locale-specific override in: templates/default/resources/checkout_de.properties

This structure ensures that:

The system uses checkout_de.properties when the storefront locale is set to de.

If a key is missing in the German file, it falls back to the default checkout.properties.

Why the other options are incorrect:

A. templates/de: Not a valid location for resource bundles — used for templates, not localization.

B. templates/default: This is where ISML templates live, not resource bundles.

C. templates/resources: Missing the required default subfolder — not recognized by the framework.

A Digital Developer is tasked with setting up a new Digital Server Connection using UX Studio in their sandbox.
Which three items are required to accomplish this task? (Choose three.)



A. Instance Version


B. Instance Hostname


C. Business Manager Username


D. Keystore Password


E. Business Manager Password





B.
  Instance Hostname

C.
  Business Manager Username

E.
  Business Manager Password

Explanation:

When setting up a Digital Server Connection in UX Studio to connect your sandbox, you must provide credentials and connection details that UX Studio uses to authenticate and communicate with your Salesforce B2C Commerce instance.

B. Instance Hostname
This is the domain name or URL of your B2C sandbox (e.g., dev01-us01.sfcc.digital or xyz.sandbox.us01.dx.commercecloud.salesforce.com)

C. Business Manager Username
Your user ID for logging into Business Manager.

E. Business Manager Password
Password for the above user — used for authenticating UX Studio to the sandbox.

Why Not the Others?:

A. Instance Version
➤ UX Studio does not need the specific version of the instance. That info is used more for compatibility awareness, not for establishing the connection.

D. Keystore Password
➤ Keystore is used when setting up secure connections or certificates (e.g., for OCAPI or integrations), not for UX Studio sandbox login.

A Digital Developer has been given a specification to integrate with a REST API for retrieving weather conditions. The service expects parameters to be form encoded.
Which service type should the Developer register?



A. FTP


B. SOAP


C. HTTP Form


D. WebDAV





C.
  HTTP Form

Explanation:

When integrating with a REST API that expects form-encoded parameters (i.e., application/x-www-form-urlencoded), the appropriate service type in Salesforce B2C Commerce is:
HTTP Form
This service type:
Sends data using form encoding, which is common for legacy REST APIs or simple POST requests.
Automatically formats parameters as key-value pairs in the request body.
Is ideal for APIs that do not accept JSON or XML payloads.

Why the other options don’t work:

A. FTP: Used for file transfers — not suitable for API calls.

B. SOAP: Designed for XML-based web services — incompatible with REST and form encoding.

D. WebDAV: Used for remote file management — not for API integration.

Given a NewsletterSubscription custom object that has a key attribute named email of type String, what is the correct syntax to create the NewsletterSubscription custom object and persist it to the database?



A. Var customobject = dw.object.CustomObjectMgr.createNewsletterSubscription(‘email’, newsLetterForm.email.value);


B. Var customobject = dw.object.CustomObjectMgr.createCustomObject(newsletterForm.email.value, ‘NewsletterSubscription’)


C. Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’, newsLetterForm.email.value);


D. Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’,’email’, newsLetterForm.email.value);





C.
  Var customobject = dw.object.CustomObjectMgr. createCustomObject (‘NewsletterSubscription’, newsLetterForm.email.value);

Explanation:

To create and persist a custom object in Salesforce B2C Commerce, use:
CustomObjectMgr.createCustomObject(objectType, keyValue);

- objectType: The ID of the custom object type (e.g., "NewsletterSubscription")
- keyValue: The value for the key attribute (e.g., the email address)

Correct Syntax Example:
var CustomObjectMgr = require('dw/object/CustomObjectMgr');
var customObject = CustomObjectMgr.createCustomObject(
    'NewsletterSubscription',
    newsletterForm.email.value
);


Why Other Options Are Incorrect:

A. createNewsletterSubscription(...) — No such method exists.
B. createCustomObject(newsletterForm.email.value, 'NewsletterSubscription') — Incorrect argument order.
D. createCustomObject('NewsletterSubscription', 'email', newsletterForm.email.value') — Too many arguments. Method only accepts two.

Important:
Wrap custom object creation in a transaction:
var Transaction = require('dw/system/Transaction');
Transaction.wrap(function () {
    var customObject = CustomObjectMgr.createCustomObject('NewsletterSubscription', newsletterForm.email.value);
    customObject.custom.firstName = newsletterForm.fname.value;
    customObject.custom.lastName = newsletterForm.lname.value;
});

Which three operations should be done in a controller?
Choose 3 answers



A. Generate the response as JSON or HTML


B. Use the Script API to generate data for the view.


C. Use middleware functions when applicable


D. Create a plain JavaScript object representing a system object
Use the model needed for the view.





A.
  Generate the response as JSON or HTML

B.
  Use the Script API to generate data for the view.

C.
  Use middleware functions when applicable

Explanation:

In SFRA (Storefront Reference Architecture), controllers are responsible for handling HTTP requests and coordinating logic, middleware, and output.

A. Generate the response as JSON or HTML ✅
Controllers must return responses in HTML (via ISML templates) or JSON (for AJAX/API endpoints).
Example:
res.render('product/details');
res.json({ success: true });

B. Use the Script API to generate data for the view ✅
Controllers often use system objects and helper scripts (e.g., ProductMgr, OrderMgr) to fetch or manipulate data before passing it to the view.

C. Use middleware functions when applicable ✅
Middleware like server.middleware.https or csrfProtection is used to validate or secure requests.
Example:
server.get('Show', server.middleware.https, function (req, res, next) { ... });

D. Create a plain JavaScript object representing a system object ❌
This is incorrect. You should use platform APIs (like ProductMgr) to work with system objects, not create plain JS objects that simulate them.

E. Use the model needed for the view ❌
Models are typically defined in external helper files or model scripts. Controllers should import and use them, but not define or construct them inline.

Page 3 out of 21 Pages
Salesforce-B2C-Commerce-Cloud-Developer Practice Test Home Previous