A B2B Commerce storefront for 'Quantum Robotics' is experiencing slow load times on the Product Detail Page (PDP), especially for products with numerous specifications and downloadable assets. A performance audit reveals that an Apex controller for a custom LWC is making multiple, sequential SOQL queries to fetch product attributes, related documents, and entitlement policies. Which of the following refactoring approaches offers the most significant performance improvement?
Answer and explanation
Correct answer: B
The most effective way to reduce database round-trips and improve Apex performance is to aggregate multiple queries into a single query. Using parent-child subqueries allows the retrieval of the product, its attributes, documents, and policies in one efficient database operation, minimizing query time and CPU usage. Caching would help subsequent loads but doesn't fix the initial slow load. Pagination is for handling large record sets, not for reducing multiple distinct queries. Asynchronous calls would not reduce the total server-side processing time for a single user's request.
Question 2
A developer at 'Momentum Manufacturing' needs to build a custom LWC that allows buyers to reorder from a previous cart. The component must display a list of past carts and, upon selection, use the B2B Reorder API to create a new cart with the same items. What is the correct sequence of API calls and actions to implement this functionality?
Answer and explanation
Correct answer: B
The correct approach is to first retrieve the historical WebCart records for the user. The B2B Commerce API provides a specific B2BReorder Apex class with a reorder method designed for this purpose. This method takes the original cart ID as input and handles the creation of the new cart and its items, returning the ID of the new cart. Finally, the user should be programmatically navigated to the new cart page. Other options misuse the APIs or suggest incorrect methods.
Question 3
A consultant is designing a solution for 'Apex Industrial Supplies' that requires different checkout experiences for two distinct buyer groups: 'High-Volume Resellers' and 'Standard Contractors'. The 'High-Volume Resellers' need a streamlined, one-page checkout, while 'Standard Contractors' require a multi-step process with a shipping address verification step. How should this be configured in B2B Commerce?
Answer and explanation
Correct answer: D
B2B Commerce natively supports assigning different checkout flows to different buyer groups. The correct method is to build the distinct flows required in Flow Builder and then use the B2B Commerce administration settings within the store to map each flow to the appropriate buyer group. This is the most scalable and maintainable solution that leverages standard platform functionality.
Question 4
A developer is tasked with extending the standard B2B Commerce payment processing logic. The requirement is to perform a fraud check with an external service before authorizing the payment. Which reference implementation should the developer extend to incorporate this custom logic?
Answer and explanation
Correct answer: C
The GatewayProvider interface is the correct reference implementation for integrating payment gateways. To add a custom fraud check, a developer would create a custom Apex class that implements this interface. Within the authorize method of this class, the developer would first make a callout to the external fraud service and then, if the check passes, proceed with the standard payment authorization logic.
Question 5
Multiple answers
To improve the user experience on the Product List Page (PLP), a developer has been asked to add a 'Compare' feature. This feature requires communication between multiple, independent productTile LWCs and a central productCompare LWC located in the page header. Which two of the following are the most appropriate and scalable mechanisms for the productTile components to notify the productCompare component when a product is selected for comparison? (Select TWO)
Answer and explanation
Correct answers: B, D
Question 6
A developer has modified an existing LWC on the cart page to display custom promotional messages. After deploying the changes, the component works correctly for authenticated users but fails to load for guest users, causing the entire cart page to show an error. The browser console shows a '403 Forbidden' error when the component's Apex controller is called. What is the most likely cause of this issue?
Answer and explanation
Correct answer: B
For a guest user to be able to invoke an @AuraEnabled method, the Guest User Profile for that specific Experience Cloud site must be granted explicit access to the Apex class. A '403 Forbidden' error is a classic symptom of this missing permission. with sharing controls record visibility, not class access. The @AuraEnabled annotation being missing would result in a different error, likely a 'method not found' on the client side. The store being inactive would prevent the entire page from loading.
Question 7
True or False: When creating a new custom field on the Product2 object to store technical specifications, this field will automatically be available to be displayed on the Product Detail Page through standard components without any further configuration.
Answer and explanation
Correct answer: B
False. After creating a custom field on an object like Product2, a developer or administrator must take additional steps to make it visible on the storefront. This typically involves updating the component's properties in Experience Builder to include the new field or, for more complex components, modifying the component's underlying code to query and display the new field's data. Field-level security for the guest or buyer user profile must also be checked.
Question 8
Case Study: 'Helios Energy Solutions' Storefront Optimization
Company Background: Helios Energy Solutions provides advanced solar panel components to a network of certified installers. Their B2B Commerce storefront is built on the Aura template and has been live for two years. They manage a complex catalog of over 5,000 products with tiered pricing and availability rules based on installer certification levels (Bronze, Silver, Gold).
Current Situation: The marketing team wants to launch a new feature: 'Project Kits'. A Project Kit is not a standard product but a collection of products (e.g., 10 panels, 1 inverter, 1 mounting kit) that can be added to the cart with a single click. The components of a kit should be priced individually based on the installer's tier, but a 5% discount should be applied to each item if purchased as part of the kit. The contents of a kit are defined by the marketing team and change frequently.
Technical Requirements:
The 'Project Kits' must be displayed on a new, dedicated page in the storefront.
When a kit is added to the cart, all individual component products must be added as separate cart line items.
A 5% adjustment must be applied to the price of each component line item originating from a kit.
The solution must be manageable by a non-technical marketing user for creating and updating kits.
The solution must scale and not negatively impact the performance of the cart and checkout process.
Problem: The development team is debating the best architectural approach to meet these requirements. Which of the following proposals represents the most scalable and maintainable solution using B2B Commerce best practices?
Answer and explanation
Correct answer: C
This solution is the most robust and aligns with B2B Commerce extension patterns. 1) Using custom objects for kits allows marketing to manage them easily via standard Salesforce UI. 2) The custom LWC correctly encapsulates the 'add to cart' logic, using the standard Cart API to ensure compatibility. 3) Extending the pricing service (ccrz.cc_hk_Pricing) is the correct, prescribed method for implementing custom pricing logic, such as a conditional discount, without modifying core code. This approach is scalable, maintainable, and separates data management from business logic correctly.
Question 9
A developer needs to modify the display of product prices to include a 'Price Per Unit' calculation (e.g., '$2.50 / kg') alongside the total price. This calculation must be applied consistently across the Product List Page, Product Detail Page, and Cart. Which is the most appropriate and maintainable approach to implement this?
Answer and explanation
Correct answer: C
Creating a single, reusable LWC for the specific task of formatting the price per unit is the best practice. This promotes code reuse, ensures consistency, and simplifies maintenance. If the formatting logic needs to change, it only needs to be updated in one place. This component can then be easily composed within the PLP, PDP, and Cart components. Formula fields are not ideal for display logic, and cloning standard components creates a significant maintenance burden.
Question 10
A storefront's checkout flow is failing intermittently with a LimitException: Too many SOQL queries: 101. A review of the debug logs points to a custom extension in the pricing service that is being invoked for each cart line item during checkout. The extension calculates custom discounts by querying related Account and Contract records. What is the most effective way to resolve this governor limit error?
Answer and explanation
Correct answer: B
This scenario describes a classic governor limit issue where a query is placed inside a loop. The solution is to bulkify the code. The correct pattern is to iterate through the cart items first, collect all the unique IDs needed for the secondary query (e.g., Account IDs, Contract IDs) into a Set or List. Then, perform a single SOQL query outside the loop to fetch all necessary records at once. The results can be stored in a Map for efficient lookup back inside the loop. This prevents the SOQL query from executing for every single cart item.