ARC-300 practice question 1 of 15

An ecommerce site has dynamic shipping cost calculation. it allows the customers to see their potential shipping costs on the Product Detail Page…

Full set: 65 questions
An ecommerce site has dynamic shipping cost calculation. it allows the customers to see their potential shipping costs on the Product Detail Page before adding an item to the cart. For this feature, shipping touts are calculated using the following logic: • Set the shipping method on the Basket • Add the item to the basket, calculate the basket total and get the shipping cost for this method • Remove the item from the Basket to restore the original state • The above process is repeated for each shipping method During the testing it was discovered that the above code violates the spi.basket.addResolveInSameResquest quota. What should the Architect do to resolve this issue and maintain the business requirement?
Answer options
A: Omit the removal of the Item and speed up the process for the customer by adding the product to the basket for them.
B: Omit the calculation of shipping cost until the customer is ready to check out and has chosen the shipping method they want to
C: Wrap each Individual step of the process its own transaction Instead of using one transaction for all steps.
D: Wrap the adding of product and shipping cost calculation in a transaction which Is then rolled back to restore the original state Correct answer
Correct Answer:
D. Wrap the adding of product and shipping cost calculation in a transaction which Is then rolled back to restore the original state
Explanation

The core issue is the violation of the spi.basket.addResolveInSameRequest quota, which limits the number of basket modifications within a single server request. The original logic performs an "add" and a "remove" operation for each shipping method, quickly exceeding this limit. The correct architectural pattern for this "what-if" calculation is to wrap the basket modification and cost calculation within a transaction and then explicitly roll it back. The dw.system.Transaction.wrap() method or a begin/rollback block allows the system to calculate costs based on a temporary basket state in memory. The rollback then discards these changes without persisting them, effectively restoring the basket's original state. This avoids the expensive remove operation and respects the platform's governance limits while fulfilling the business requirement.

References

1. Salesforce B2C Commerce Developer Center, dw.system.Transaction Class Documentation: The official documentation describes the use of transactions for grouping database operations. The pattern of beginning a transaction, performing temporary modifications for calculation, and then rolling back is the standard approach for "what-if" scenarios to avoid persisting changes. The wrap(callable) method is often highlighted as a best practice for this.

2. Salesforce B2C Commerce Developer Center, "Custom Code Limits (Quotas)": This documentation outlines the platform's governance limits. The spi.basket.addResolveInSameRequest quota is defined here, specifying the maximum number of product line items that can be created and resolved in a basket within a single request. The described problem (looping add/remove) is a classic example of how this quota is violated.

3. Salesforce B2C Commerce Architect B2C Commerce Functional, Courseware (e.g., ARCH300): Official course materials for the B2C Commerce Architect certification explicitly cover performance best practices and adherence to platform quotas. They recommend using the transaction rollback pattern for temporary calculations on the basket to prevent performance degradation and avoid hitting governance limits like the one described.

Scroll to Top