Cert++
Close

Surfacing calculation errors with CartValidationOutput

Key Takeaway

When a custom cart extension fails, make sure it creates a CartValidationOutput. By default, buyers see the message only when its Level is Error and its Type is Inventory, Pricing, Promotions, or Entitlement.

CartValidationOutput is the record a B2B Commerce or D2C Commerce cart uses to hold errors, warnings, and info messages, such as "Out of stock". Each message is tied to the cart itself or to a specific cart item, delivery group, or tax. Custom cart extensions create these outputs when a calculation fails, so the problem can be shown and handled instead of leaving checkout stuck.

Why a failed extension needs an output

Make sure every custom extension (Tax, Inventory, Pricing, Promotions, Shipping) creates a CartValidationOutput record whenever it fails. A custom extension that fails without creating one is a common misconfiguration. Checkout then stays in an inconsistent or blocked state. The error is also hard to surface or handle.

Salesforce Accredited B2B Commerce Developer Professional Study Guide

Checklist progress

0/124Learned

Code implementations against the 4 crucial reference implementations used in checkout and payment interfaces with in-depth knowledge of all supported actions

0/23

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other Salesforce Accredited B2B Commerce Developer Professional studiers.