Skip to main content
To handle real-world shopping scenarios that AI agents encounter, implement robust error handling patterns that provide clear context and actionable resolution options. This guide shows you how to structure validation responses for common integration challenges including inventory issues, pricing changes, shipping restrictions, geographic limitations, and system maintenance scenarios. These validation issues are returned either as part of an INCOMPLETE cart in the validation_issues array, or within a 422 Unprocessable Entity response in details[].business_context when the merchant could not create the cart or apply the requested updates.
Note: You can view the complete protocol reference for the Cart API and the Complete Checkout API.

Inventory and stock management errors

Inventory issues are among the most common errors in e-commerce. These examples show how to handle out-of-stock scenarios, back-orders, and discontinued products gracefully. Return a separate validation issue for each item that fails, and include the variant_id so the AI agent can identify the affected item.

Out of stock with alternatives

When a requested item is out of stock, provide alternative products and clear communication about availability.

Back-order scenario

For items that can be back-ordered, communicate delivery delays and allow customers to decide.

Discontinued product

When a product is no longer available, guide customers to newer or similar alternatives.

Pricing and financial errors

Price changes can occur between cart creation and checkout. These error patterns help you handle pricing discrepancies transparently while maintaining customer trust.

Price change during checkout

Handle price increases that occur between cart creation and checkout with transparency.

Shipping and address errors

Address validation ensures successful delivery while preventing fraud. These examples demonstrate handling invalid addresses, PO box restrictions, and shipping limitations.

Invalid shipping address

When address validation fails, provide specific corrections to help customers fix the issue.

PO box restrictions

For this example, items that require signature delivery cannot be sent to a PO box. Explain why PO box delivery isn’t available for those items.
Some products or merchants have regional restrictions due to regulations or business policies. These errors help communicate limitations clearly to customers.

Regional sales restrictions

Communicate geographic limitations due to business policies or regulatory compliance.

System and store errors

Temporary system issues require special handling to maintain customer relationships. These patterns show how to communicate maintenance windows and system unavailability.

Store maintenance mode

During scheduled maintenance, provide clear timing for when services will resume.