CCD-102 practice question 28 of 30

Universal Containers is preparing their storefront to use Open Commerce APIs (OCAPI). To which hook should the Digital Developer move taxation logic to ensure consistent order totals within B2C Commerce?

Full set: 206 questions
Answer options
A: dw.ocapi.shop.order.validateOrder
B: dw.ocapi.shop.basket.calculate Correct answer
C: dw.ocapi.shop.basket.afterPostShipment
D: dw.ocapi.shop.order.afterPOST
Correct Answer:
B. dw.ocapi.shop.basket.calculate
Explanation

The dw.ocapi.shop.basket.calculate hook is the designated extension point for customizing the basket calculation process. To ensure consistent and accurate order totals, all logic related to pricing, shipping, promotions, and taxation must be consolidated and executed within this hook. It is triggered whenever a basket's totals need to be computed, ensuring that the final amounts are correct before the customer proceeds to the order creation step. Placing taxation logic here guarantees it is applied consistently across all OCAPI interactions that affect the basket total.

References

1. Salesforce B2C Commerce Infocenter

Open Commerce API (OCAPI) Hooks: The official documentation lists the dw.ocapi.shop.basket.calculate hook with the description: "Called during the basket calculation. Can be used to implement custom basket calculation logic." This explicitly identifies it as the correct location for customizing calculations

including taxes. The descriptions for the other hooks confirm their different purposes (validation or post-processing). (Reference: B2C Commerce Developer > Development for B2C Commerce > Open Commerce API > OCAPI Hooks)

2. Salesforce B2C Commerce Infocenter

OCAPI Hook Circuit: The documentation on the hook execution flow shows that calculate is part of the basket modification and retrieval process

which precedes the createorder resource call. The validateOrder and afterPOST hooks are part of the createorder resource itself

confirming the timing difference. (Reference: B2C Commerce Developer > Development for B2C Commerce > Open Commerce API > OCAPI Settings and Configurations)

Scroll to Top