Hi There, I am trying to collect the suburb, state and postcode in the checkout UI extension to be able to build shipping validation. However, everything populates except the zip (postal code).
This seems like a correct way to use the useShippingAddress Hook to access the shipping address information.
Here are a couple of things you can check:
Data availability: Ensure that the zip code is actually available in the shipping address. You can do this by logging the entire address object to the console and checking its properties.
console.log(address);
Shipping address completion: The hook might not return the zip code if it’s not yet filled in by the user. Make sure the checkout process is at a stage where the shipping address, including the zip code, is already provided.
API version: Ensure that the version of the @Shopify_77 /ui-extensions-react/checkoutpackage you are using supports the zip property. You can check the package documentation or update to the latest version.
Property name: Ensure that you’re using the correct property name. While zip is commonly used, some APIs might use other names like postalCode.