Back to Developer changelog

Optional Address Validation in Storefront API

API

Effective December 19, 2023

As of Storefront API's 2024-04 release, you can use buyerIdentity.deliveryAddressPreferences.deliveryAddressValidationStrategy (accepted values STRICT or COUNTRY_CODE_ONLY) to enable address validation on the passed deliveryAddress for any cart mutations that accept a buyer identity as input (like cartCreateor cartBuyerIdentityUpdate).

Passing STRICT will perform a full validation on the address fields, and will raise CartUserErrors for invalid addresses. Invalid addresses will not be stored on the cart.

Passing COUNTRY_CODE_ONLY or omitting the field will only validate the presence of a valid country in the address (unchanged behavior from previous version).