Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

CheckoutCreate with shipping address throws BLANK error for UAE addresses

CheckoutCreate with shipping address throws BLANK error for UAE addresses

lighthousebloom
Visitor
1 0 0

I'm using the Storefront API to create a checkout URL and fetch available shipping rates. For most addresses, this is working properly, however for addresses in the United Arab Emirates, it throws an error.

 

For context, UAE addresses contain an address1 line, a province (emirate), and the country, nothing else. However, the checkoutCreate mutation throws an error that says I need to enter a city. If I remove the province/emirate and enter a city, it throws an error that says I need to enter an emirate. The only way to not receive an error is to enter both the city and emirate.

 

I know that this is specific to UAE addresses because I also ship to Gibraltar, and even though Gibraltar does not have a city or state, the checkoutCreate mutation succeeds.

 

This is the format of the mutation I'm sending:

mutation checkoutCreate($input: CheckoutCreateInput!) {
    checkoutCreate(input: $input) {
      checkout {
        id
        availableShippingRates {
          ready
          shippingRates {
            handle
            price {
              amount
              currencyCode
            }
            title
          }
        }
        webUrl
      }
      checkoutUserErrors {
        message
        code
      }
    }
  }

This is the format of the input I'm sending:

const variables: CheckoutCreateMutationVariables = {
      input: {
        allowPartialAddresses: false, // setting this to true also throws the same error
        email,
        lineItems: lineItems.map((product) => ({
          quantity: product.quantity,
          variantId: product.variantId,
        })),
        shippingAddress,
      },
    };

And here is an example input for a UAE address that throws the BLANK error:

address: {
      city: null, // replacing this with "Dubai" fixes the error
      province: "Dubai", // removing this (with or without a defined city) throws a BLANK error
      zip: null,
      address2: null,
      address1: "119 6D St",
      country: "AE"
    }
Replies 0 (0)