App reviews, troubleshooting, and recommendations
Hi Developer,
I am trying to create a checkout extension function that would block the postcode in the checkout page.
Below is my extension code to block postcode 2022, however, it is not working/blocking.
I would really appreciate your help and information:
import {
reactExtension,
useBuyerJourneyIntercept,
useShippingAddress,
Banner,
BlockStack,
} from "@shopify/ui-extensions-react/checkout";
export default reactExtension(
"purchase.checkout.shipping-option-list.render-after",
() => <ZipCodeValidator />
);
function ZipCodeValidator() {
const shippingAddress = useShippingAddress();
useBuyerJourneyIntercept(({ canBlockProgress }) => {
const zip = shippingAddress?.zip;
if (canBlockProgress && zip === "2022") {
return {
behavior: "block",
reason: "Invalid ZIP Code.",
errors: [
{
message: "We do not ship to ZIP code 2022. Please enter a different ZIP code.",
},
],
};
}
return { behavior: "allow" };
});
return (
<BlockStack>
<Banner status="critical">
We do not ship to ZIP code 2022. Please provide a different ZIP code.
</Banner>
</BlockStack>
);
}
Many thanks
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025