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 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?



A. Make sure that the developer has “Administrator” Access, then change the Taxation setting to Gross


B. Unlock the site preferences and then change the Taxation setting to Gross


C. Change the global setting,”Enable Taxation Methods” to true, then change the Taxation setting to Gross


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





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

Explanation:

In Salesforce B2C Commerce, the Taxation Policy (Net or Gross) is a site-level setting that is configured only at the time of site creation. Once the site is created, this setting cannot be changed through Business Manager.

According to Salesforce documentation:

“The site taxation policy determines whether product and other prices are treated as gross or net prices for the site. This policy is configured at site creation and can only be changed by Commerce Cloud Support.”

Because Business Manager does not allow changing this setting post-creation, the only viable option is to:

Create a new site with the desired taxation policy set to Gross

Migrate necessary data (catalogs, configurations, etc.)

Delete or disable the old site if no longer needed

Why the other options are incorrect

A. Administrator access Even with full admin rights, you cannot change the taxation policy after site creation.

B. Unlocking site preferences Unlocking preferences does not expose the taxation policy setting — it remains read-only.

C. Enable Taxation Methods globally There is no global toggle that allows switching between Net and Gross for an existing site.

A Digital Developer needs to store information temporarily and decides to create a custom object.
Which code creates a custom object?



A. CustomObject.createCustomObject(CustomObjectType,primaryKey);


B. CustomObject.createCustomObject(primaryKey,CustomObjectType);


C. CustomObjectMgr.createCustomObject(primaryKey);


D. CustomObjectMgr.createCustomObject(CustomObjectType,primaryKey)





D.
  CustomObjectMgr.createCustomObject(CustomObjectType,primaryKey)

Explanation:

To create a custom object instance in Salesforce B2C Commerce, you do not call CustomObject.createCustomObject(...) directly. Instead, you use the CustomObjectMgr class, which provides methods for creating, retrieving, and managing custom objects.

The correct method is:

CustomObjectMgr.createCustomObject(customObjectType, primaryKey);

customObjectType → The ID of the custom object type (defined in Business Manager).
primaryKey → The unique identifier for the custom object instance.

✅ This is the only valid and supported method to create a custom object in B2C Commerce.

Why not the others?

A. CustomObject.createCustomObject(CustomObjectType, primaryKey);
➤ This is incorrect because CustomObject does not have a createCustomObject() method.

B. CustomObject.createCustomObject(primaryKey, CustomObjectType);
➤ Also incorrect — same reason: wrong class and wrong parameter order.

C. CustomObjectMgr.createCustomObject(primaryKey);
➤ Invalid — this method requires two parameters, not one.

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?



A. Pipeline profiler


B. Code Profiler


C. Storefront Toolkit


D. Reports and Dashboards Module





C.
  Storefront Toolkit

Explanation:

The Storefront Toolkit is the primary tool developers use to debug storefront-related issues, including session problems, customer account data, and personalization issues.

If the Account Addresses page is showing the wrong shopper’s address, it likely indicates a session, context, or personalization issue—such as data being pulled from the wrong customer or session scope.

Using the Storefront Toolkit, a developer can:

Impersonate shoppers
Inspect session and request scopes
View request parameters
Identify which customer is currently logged in
See the context in which components are being rendered

This makes it ideal for diagnosing issues where user-specific data appears incorrectly, such as in this case.

Why not the others?

A. Pipeline Profiler
➤ Used to analyze performance and execution times of pipelines (relevant to SiteGenesis, not SFRA). Not suited for session or data integrity issues.

B. Code Profiler
➤ Useful for profiling backend code performance, not identifying session or shopper-specific display issues.

D. Reports and Dashboards Module
➤ This is used for business analytics and not for debugging technical or user-session-related issues.

Given the customer basket described below:
• A customer has an existing basket that consists of multiple items.
• One of the items is identified as a gift ítem by an attribute at the product line ítem.
The developer needs to write custom code to fetch the customer basket and then modify the basket based
upon the items in the cart. If the basket contains any gift items, modify the basket and create a separate
shipment for the gift item.
Four hooks are required to make the modification, beginning with modifyGETRespone and ending with
validatebasket.
• Dw.ocapi.shop.basket.modifyGETResponse
• - missing hook –
• - missing hook -
• dw.ocapi.shop.basket.validateBasket
What are the two missing hooks in the middle?



A. dw.ocapi.shop.basket.shipment.afterDELETE


B. dw.ocapi.shop.basket.shipment.beforePATCH


C.

dw.ocapi.shop.basket.shipment.beforeDELETE


D. dw.ocapi.shop.baskep.shopment.beforePOST


E. Estos indican antes de actualizar y antes de introduci





B.
  dw.ocapi.shop.basket.shipment.beforePATCH

D.
  dw.ocapi.shop.baskep.shopment.beforePOST

Explanation:

To implement logic that modifies the basket by creating a separate shipment for gift items, you need to intercept and manipulate the basket during shipment creation and update. The full hook sequence would be:

dw.ocapi.shop.basket.modifyGETResponse

Used to enrich the basket response with custom data (e.g., flag gift items)

dw.ocapi.shop.basket.shipment.beforePOST

Triggered before a new shipment is created
Ideal for assigning gift items to a new shipment

dw.ocapi.shop.basket.shipment.beforePATCH

Triggered before an existing shipment is updated
Useful for adjusting shipment details or reassigning items

dw.ocapi.shop.basket.validateBasket

Ensures the basket is valid before checkout
Can be used to confirm gift items are correctly separated

Why the other options are incorrect

A. shipment.afterDELETE
Only runs after a shipment is deleted — not relevant to creating or modifying shipments.

C. shipment.beforeDELETE
Used when removing a shipment, not when creating or updating.

A business user wants to add a link to a content page from within the body of another content asset. The target content asset ID is: terms-and-conditions.
Which link function generates the correct link?



A. $include(‘Page-Include’, ‘cid’, ‘terms-and-conditions’)$


B. $http(‘Content-Page’, ‘cid’, ‘terms-and-conditions’)$


C. $httpUrl(‘Content-Show’, ‘cid’, ‘terms-and-conditions’)$


D. $url(‘Page-Show’, ‘cid’, ‘terms-and-conditions’)$





C.
  $httpUrl(‘Content-Show’, ‘cid’, ‘terms-and-conditions’)$

Explanation:

In Salesforce B2C Commerce (SFRA), when you want to link to a content page from within another content asset, you need to generate a full absolute URL using the correct controller and parameters.

Content-Show is the controller used to display content assets.

cid is the parameter name for the Content Asset ID.

$httpUrl(...)$ is used to generate a full absolute URL (i.e., https://www.example.com/page-path), which is ideal when embedding links inside rich text or HTML in content assets.

Thus, this line:

$httpUrl('Content-Show', 'cid', 'terms-and-conditions')$

…generates a complete URL pointing to the terms-and-conditions content page.

Why not the others?

A. $include('Page-Include', 'cid', 'terms-and-conditions')$
→ Used for server-side includes, not hyperlink generation.

B. $http('Content-Page', 'cid', 'terms-and-conditions')$
→ Content-Page is not a valid controller in SFRA.

D. $url('Page-Show', 'cid', 'terms-and-conditions')$
→ Page-Show is used for Page Designer pages, not standard content assets.

Given the following conditions:

• Site export file with a copy of the Storefront data for a custom site
• Sandbox with the custom site code, but no Storefront data
• Requirement for a working copy of SFRA for development reference

A developer is assigned the following Business manager tasks:

A. Import the custom Site using Site Import/Export
B. Import the SFRA Demo Sites using Site Import/Export
C. Rebuild the custom Site search indexes

In what sequence should the developer perform the tasks, so that the custom Site displays the products as intended?



A. Task A, then C, then B


B. Task B, then C, then Ap


C. Task A, then B, then C


D. Task B, then A, then C





D.
  Task B, then A, then C

Explanation:

To ensure the custom site displays products as intended and also has a working SFRA reference, the tasks must be completed in an order that builds up both the base functionality and the custom data properly:

🔢 Task Breakdown:
Task B: Import the SFRA Demo Sites

This sets up the baseline SFRA reference sites like RefArch or RefArchGlobal.
It includes necessary system objects, shared resources, and configurations that custom sites may depend on.
Without this, your custom site might reference missing resources or templates.

Task A: Import the custom site

After the baseline is in place, import the custom storefront data (products, categories, content assets, etc.).
This step builds on the data structure from the demo site if needed.

Task C: Rebuild the custom site's search indexes

After all data is imported, you must rebuild search indexes for the site.
This ensures products, categories, and other searchable content appear on the storefront.

A developer has custom debug statements in a script, but the messages are not showing up in the
Storefront Toolkit Request Log.
Which step needs to be completed to get the messages to appear in the Request Log?



A. In Global preferences, check the box for Enable custom logging in Request Log.


B. In Site Preferences, check the box for Enable custom Logging in Request Log


C. In Custom Log Settings, check the DEBUG box for Select Log Levels Written to Files.


D. In custom Log Settings, activate the loggin category at DEBUG level





D.
  In custom Log Settings, activate the loggin category at DEBUG level

Explanation:

For custom debug statements to appear in the Storefront Toolkit Request Log, the developer must:

Activate the Logging Category at DEBUG Level:

Navigate to Business Manager > Administration > Logging > Custom Log Settings.

Locate the specific logging category used in the script (e.g., my.custom.category).

Set the Log Level to DEBUG (or lower, e.g., INFO, ERROR).

Example code with logging category:

var log = Logger.getLogger('my.custom.category'); log.debug('Debug message'); // Will now appear in Request Log

Why Option D?

The Request Log only displays messages if:

The logging category is active.
The log level (e.g., DEBUG) matches or is lower than the configured level.

Why Not Other Options?

A/B (Global/Site Preferences):
There is no "Enable custom logging in Request Log" checkbox in preferences.

C (Select Log Levels Written to Files):
Controls log file output, not the Request Log in Storefront Toolkit.

The following code ensures that an address ID CANNOT be used if it is already in use by another address in the customer’s address book. There is a problem with the code. The error message for an invalid address ID is never shown to the user on the form field.



How should the Digital Developer resolve this issue so that the error message is displayed on the address ID form field?



A. addressForm.invalidateFormElement("addressid");


B. addressForm.addresssid.invalidateFormElement = true;


C. addressForm.invalidateFormElement(addressForm.addressid);


D. addressForm.addresssid.invalidateFormElement();





A.
  addressForm.invalidateFormElement("addressid");

Explanation:

In Salesforce B2C Commerce, to invalidate a specific form field and show an error message on it, you must call:

addressForm.invalidateFormElement("addressid");

This method:

Marks the field as invalid
Triggers the display of the associated error message (e.g., value-error)
Ensures the user sees the feedback directly on the form field

Why the other options are incorrect

B. addressForm.addressid.invalidateFormElement = true; This incorrectly tries to assign a boolean to a method — it won’t trigger validation.

C. addressForm.invalidateFormElement(addressForm.addressid); This passes the form element object instead of its string ID — not the expected argument type.

D. addressForm.addressid.invalidateFormElement(); This assumes invalidateFormElement is a method on the field object — it’s not.

Universal Containers wants to associate a region code value with an order to indicate the general area of its destination. This region code must be accessible whenever the order history is displayed.
What is required to accomplish this?



A. Store the region code value in a session variable.


B. Define a custom attribute on the Order system object type to store the region code value


C. Define a custom object type to store the username with the region code.


D. Store the region code value in the geolocation system attribute of the Orde





B.
  Define a custom attribute on the Order system object type to store the region code value

Explanation:

To persist data like a region code with an order and ensure it is available for display later (e.g., in order history), the best practice is to:

Extend the Order system object with a custom attribute (e.g., regionCode)

This makes the region code:

Saved with the order record in the database
Accessible across storefront, Business Manager, and APIs

Why other options are incorrect:

A. Store in a session variable
🔴 Session variables are temporary and only last for the duration of the user session. Not suitable for long-term storage like order history.

C. Define a custom object type
🔴 Custom objects are best used for unrelated, standalone data. Associating data with orders is better handled with a custom attribute on the Order object.

D. Use the geolocation system attribute
🔴 geolocation stores latitude/longitude, not suitable for custom region code values. It's also not visible or intended for business logic.

A developer is writing a server side script that needs to maintain state across calls. The persistent information needed includes these items.

• The current customer
• Whether or not the customer is authenticated
• The privacy attributes (such as tracking consent or cookie policy)

Which technique should the developer use to maintain state in an efficient and scalable manner that follows best practice?



A. Use a non-replicable Custom Object to store the information temporarily


B. Use the Session class in the B2C Commerce api.


C. Use an SFRA controller, because it runs server-side, the state is automatically maintained


D. Use a client-side cookie to store the information for the session duration





B.
  Use the Session class in the B2C Commerce api.

Explanation:

In Salesforce B2C Commerce, the Session class is the recommended and scalable way to maintain state across server-side calls during a shopper's visit. It provides access to:

Current customer: via session.customer

Authentication status: via session.customer.authenticated

Privacy attributes: via session.privacy (e.g., tracking consent, cookie policy)

✅ Example Usage:
var customer = session.customer;
var isAuthenticated = customer.authenticated;
var trackingConsent = session.privacy.trackingConsent;

These values persist throughout the session and are automatically scoped to the current user, making them ideal for temporary state management.

Why the other options are incorrect

A. Non-replicable Custom Object Custom Objects are not designed for session-level state. They are persisted in the database and not efficient for transient data.

C. SFRA controller automatically maintains state SFRA controllers are stateless between requests. You must explicitly use session or other mechanisms to persist data.

D. Client-side cookie Storing sensitive data like authentication or privacy preferences in client-side cookies is insecure and violates best practices.

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