Salesforce-B2C-Commerce-Cloud-Developer Practice Test
Updated On 1-Jan-2026
202 Questions
A developer wants to configure multiple products that should only be sold as a group. It should not bepossible for buyers to buy these products individually. How should the developer configure the products?
A. Bundle
B. Set
C. Variation Group
Explanation:
🔍 Requirement:
Multiple products should be sold as a group and not individually.
You want to group multiple products into a single purchasable unit, so the shopper can only buy them together, not separately.
🧩 Why Option A: Bundle is Correct
A Bundle in Salesforce B2C Commerce (SFCC) is:
A composite product made of multiple component products
Purchased as a single unit
Typically used when products are meant to be sold together
The components are not purchasable separately from the storefront when they’re marked as part of a bundle
➡️ Best fit for the scenario: sell as a fixed group, not individually.
❌ Why the Other Options Are Incorrect:
B. Set
A set is a group of products shown together, but each product is purchasable individually
❌ Does not enforce group-only purchase
C. Variation Group
A variation group is for products with attributes (e.g., size/color) — a subset of variations shown as a group ❌ Not for bundling multiple distinct products
📘 Reference:
Product Types: Bundles vs Sets vs Variants
Bundles in B2C Commerce
Which method isefficient and scalable because it uses the product search index rather than searching the database?
A. ProducrlndexModel.getOrderableProductsOnly()
B. ProduccAvailabiliryModel.isOrderable()
C. ProductSearcbHodel().gerProductSearchHita()
D. ProductVanari.cnMcciel.aerVariams ()
Explanation:
The most efficient and scalable method that uses the product search index rather than searching the database is C: ProductSearchModel().getProductSearchHits(). This method leverages the B2C Commerce search index, which is optimized for performance and scalability, to retrieve product search results, making it ideal for large-scale queries compared to direct database searches.
Reasoning:
Search Index vs. Database: B2C Commerce uses a search index (maintained via Business Manager > Merchant Tools > Search > Indexing) to optimize product searches, reducing the load on the database. Methods relying on the index are more efficient for large catalogs or frequent queries.
A. ProductIndexModel.getOrderableProductsOnly()
Incorrect. There is no ProductIndexModel or getOrderableProductsOnly() method in the B2C Commerce Script API. This appears to be a distractor, possibly a misinterpretation of index-related functionality.
B. ProductAvailabilityModel.isOrderable()
Incorrect. The ProductAvailabilityModel.isOrderable() method checks a product’s availability based on inventory data, querying the database directly rather than using the search index. It’s not designed for scalable product searches.
C. ProductSearchModel().getProductSearchHits()
Correct. The ProductSearchModel class (from dw.catalog.ProductSearchModel) uses the search index to retrieve a list of ProductSearchHit objects matching a query. This method is optimized for performance, supporting filters, sorting, and pagination, making it efficient and scalable for storefront search or category pages.
Example:
var ProductSearchModel = require('dw/catalog/ProductSearchModel');
var searchModel = new ProductSearchModel();
searchModel.setCategoryID('categoryID');
searchModel.search();
var hits = searchModel.getProductSearchHits();
D. ProductVariantModel.getVariants()
Incorrect. The ProductVariantModel.getVariants() method retrieves variant products for a master product, querying the database or product catalog directly. It does not utilize the search index, making it less efficient for large-scale searches.
Implementation Note:
The getProductSearchHits() method returns an iterator of ProductSearchHit objects, which include product IDs and relevance scores, optimized for search performance. It’s commonly used in controllers or scripts to power storefront search results.
Reference:
Salesforce B2C Commerce Documentation: ProductSearchModel API details index-based searching.
Trailhead Module: “B2C Commerce Developer” module on “Search and Navigation” covers search index usage.
Exam Tip:
For the Salesforce B2C-Commerce-Developer exam, identify ProductSearchModel().getProductSearchHits() as the index-based method, avoiding distractors with incorrect class names or database-dependent methods. Note typos (e.g., ProducrlndexModel, ProduccAvailabiliryModel) as common exam tricks.
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?
A. res.json()
B. res.render()
C. res.print()
Explanation:
When handling client-side AJAX requests in Salesforce B2C Commerce SFRA, the best practice is to use:
res.json() — to send structured data (JSON) back to the browser for processing by client-side JavaScript.
📦 Why res.json() is best for AJAX:
It returns a JSON-formatted HTTP response, which is easy to handle in JavaScript.
It's ideal for partial page updates — such as cart updates, product info refresh, or stock availability.
It avoids re-rendering a full page, supporting a modern interactive UX.
✅ Example:
server.get('UpdateStock', function (req, res, next) {
var productInfo = {
stock: 12,
productId: '12345'
};
res.json(productInfo);
next();
});
🧠 In the browser:
fetch('/YourController-UpdateStock')
.then(res => res.json())
.then(data => {
document.querySelector('#stockCount').innerText = data.stock;
});
❌ Why the other options are incorrect:
res.render()
Renders an ISML template (used for full pages or HTML fragments); not ideal for AJAX unless you're injecting raw HTML.
res.print()
Sends a raw string response; works, but lacks structure and makes parsing harder for the client. Not modern or clean.
📘 Reference:
SFRA Controller Response Methods
MDN – Fetch API
Given a template rendered by a controller with caching and a remote include without caching, which situation applies?
A. Both the remote include portion and the rest of the page are cached.
B. The remote include portion is not cached, but the rest of the page is cached.
C. The page is cached only for returning customers because of the remote include.
D. The page is not cached because the remote include introduces an uncached portion.
Explanation:
Controller-Level Caching:
When a controller uses caching (e.g., cache.applyDefaultCache), the main page content is cached.
This cached content includes all static parts of the template.
Remote Includes:
Remote includes (< isinclude > or remote service calls) are not cached by default unless explicitly configured.
They are fetched fresh on each request, even if the surrounding page is cached.
Resulting Behavior:
The main page structure (cached portions) is served from cache.
The remote include portion is dynamically generated for each request.
Why Not Other Options?
A: Incorrect - Remote includes don't inherit the parent page's cache.
C: Incorrect - Caching isn't customer-specific in this scenario.
D: Incorrect - The page is still cached; only the remote portion is dynamic.
Key Takeaway:
This hybrid approach is common for pages needing both performance (caching) and real-time data (uncached includes).
Reference:
SFRA Caching Documentation
CORRECT TEXT
There is a business requirement to allow a third-party warehouse management system to
update the MySampte.com storefront product inventory in real time.The architect decided
that this is most easily accomplished by using the Open Commerce API (OCAPI). The
developer needs to test the OCAPI settings m their sandbox. Assume the client ID for
testing is "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'. What B the correct GCAPI setting for
this?
Explanation:
To enable a third-party warehouse management system to update the MySample.com storefront product inventory in real time using the Open Commerce API (OCAPI), the developer must configure the Data API settings in the sandbox. Using the test client ID "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", the developer should enable the /inventory_lists/{inventory_list_id}/product_inventory_records/{product_id} resource with PATCH permissions in Business Manager > Administration > Site Development > Open Commerce API Settings > Data API Settings. This allows the third-party system to modify inventory levels for the specified inventory list (e.g., ecom-inventory).
Reasoning:
OCAPI Data API: The Data API supports inventory management, and the /inventory_lists/{inventory_list_id}/product_inventory_records/{product_id} endpoint with the PATCH method is designed for updating product inventory records in real time.
Client ID Configuration: The demo client ID "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" is used for testing in the sandbox. It must be authorized to access the inventory resource.
Correct Setting: In the Data API settings JSON, the developer should include:
{
"_v": "23.6",
"clients": [
{
"client_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"resources": [
{
"resource_id": "/inventory_lists/{inventory_list_id}/product_inventory_records/{product_id}",
"methods": ["patch"],
"read_attributes": "(**)",
"write_attributes": "(**)"
}
]
}
]
}
Replace {inventory_list_id} with the actual ID (e.g., ecom-inventory) used by MySample.com.
The (**) wildcard allows read and write access to all attributes, though specific attributes can be restricted for security.
Implementation: The third-party system would send a PATCH request (e.g., https://
Steps to Configure:
Access OCAPI Settings:
In Business Manager, go to Administration > Site Development > Open Commerce API Settings.
Edit Data API:
Select "Data" and edit the JSON for the MySample.com site.
Add Resource:
Add the inventory resource with PATCH method and save.
Test the API:
Use a tool like Postman to send a test PATCH request with the client ID and verify the inventory update.
Reference:
Salesforce B2C Commerce Documentation: Data API Resources.
Trailhead Module: “B2C Commerce Developer” module on “OCAPI” covers resource configuration.
Exam Tip:
For the Salesforce B2C-Commerce-Developer exam, know that the Data API’s inventory resource with PATCH is used for real-time updates, and the client ID must be configured with appropriate permissions. Be cautious of typos in resource paths or methods.
| Salesforce-B2C-Commerce-Cloud-Developer Exam Questions - Home | Previous |
| Page 5 out of 41 Pages |