Developer changelog

Subscribe to the changelog to stay up to date on recent changes to Shopify’s APIs and other developer products, as well as preview upcoming features and beta releases.

Get updates by RSS

Optional Address Validation in Storefront API

API

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).