Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-missing-shipping-info-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@godaddy/react": patch
---

Return the missing shipping info error when checkout is blocked by absent shipping lines or fulfillment.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export function useConfirmCheckout() {
isShipping &&
(!hasShippingLines || hasLineItemsMissingShippingFulfillment)
) {
setCheckoutErrors(['SHIPPING_METHOD_APPLICATION_FAILED']);
throw new Error('SHIPPING_METHOD_APPLICATION_FAILED');
setCheckoutErrors(['MISSING_SHIPPING_INFO']);
throw new Error('MISSING_SHIPPING_INFO');
}

const pickUpData = isPickup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ export function ShippingMethodForm() {
const formatCurrency = useFormatCurrency();
const form = useFormContext();
const { t } = useGoDaddyContext();
const { session, isConfirmingCheckout, setCheckoutErrors } =
useCheckoutContext();
const { session, isConfirmingCheckout } = useCheckoutContext();
const updateTaxes = useUpdateTaxes();
const queryClient = useQueryClient();
const isPaymentDisabled = useIsPaymentDisabled();
Expand Down Expand Up @@ -205,14 +204,6 @@ export function ShippingMethodForm() {
queryKey: ['draft-order', session.id],
});
},
onError: () => {
if (!isFulfillmentSync || !session?.id) return;

setCheckoutErrors(['SHIPPING_METHOD_APPLICATION_FAILED']);
queryClient.invalidateQueries({
queryKey: ['draft-order', session.id],
});
},
});
} else if (session?.enableTaxCollection) {
updateTaxes.mutate(undefined);
Expand All @@ -239,7 +230,6 @@ export function ShippingMethodForm() {
form,
applyShippingMethod,
updateTaxes.mutate,
setCheckoutErrors,
session?.enableTaxCollection,
queryClient,
session?.id,
Expand Down