diff --git a/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/useGuestForm.spec.js.snap b/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/useGuestForm.spec.js.snap index b88eab9521..ef2ec8b430 100644 --- a/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/useGuestForm.spec.js.snap +++ b/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/useGuestForm.spec.js.snap @@ -9,11 +9,7 @@ Object { "firstname": "Philip", "lastname": "Fry", "postcode": "10019", - "region": Object { - "region": "New York", - "region_code": "NY", - "region_id": 12, - }, + "region": 12, "street": Array [ "3000 57th Street", "Suite 200", @@ -37,11 +33,7 @@ Object { "firstname": "Philip", "lastname": "Fry", "postcode": "10019", - "region": Object { - "region": "New York", - "region_code": "NY", - "region_id": 12, - }, + "region": 12, "street": Array [ "3000 57th Street", ], diff --git a/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js b/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js index b18f03f6b7..8ca00ceae2 100644 --- a/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js +++ b/packages/peregrine/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js @@ -60,7 +60,7 @@ export const useGuestForm = props => { const handleSubmit = useCallback( async formValues => { - const { country, email, ...address } = formValues; + const { country, email, region, ...address } = formValues; try { await setGuestShipping({ variables: { @@ -70,7 +70,8 @@ export const useGuestForm = props => { ...address, // Cleans up the street array when values are null or undefined street: address.street.filter(e => e), - country_code: country + country_code: country, + region: region.region_id || region.region } } }); @@ -78,7 +79,6 @@ export const useGuestForm = props => { } catch { return; } - if (afterSubmit) { afterSubmit(); }