GraphQL orderCreate Customer data does not get populated

I am trying to create an order with the code below. Only the customer’s first and last name are populated, but the shipping and billing addresses are not. Even when I try to pass them directly, as shown in the commented-out portion of the code, they still do not appear in the created order. Why is this happening?

  const query = {
    query: `
      mutation OrderCreate($order: OrderCreateOrderInput!, $options: OrderCreateOptionsInput) {
        orderCreate(order: $order, options: $options) {
          order {
            id
          }
          userErrors {
            field
            message
          }
        }
      }
    `,
    variables: {
      order: {
        name: orderName,
        email: payload.email,
        currency: payload.currency,
        tags: "Child",
        presentmentCurrency: payload.line_items[0].price_set.presentment_money.currency_code,
        currency: payload.line_items[0].price_set.shop_money.currency_code,
        
        customer: {
          toAssociate: {
            id: payload.customer.admin_graphql_api_id
          }
        },
        
        // shippingAddress: {
        //   firstName: payload.shipping_address.first_name,
        //   lastName: payload.shipping_address.last_name,
        //   address1: payload.shipping_address.address1,
        //   phone: payload.shipping_address.phone,
        //   city: payload.shipping_address.city,
        //   zip: payload.shipping_address.zip,
        //   countryCode: payload.shipping_address.country_code,
        //   provinceCode: payload.shipping_address.province_code
        // },
        
        // billingAddress: {
        //   firstName: payload.billing_address.first_name,
        //   lastName: payload.billing_address.last_name,
        //   address1: payload.billing_address.address1,
        //   phone: payload.billing_address.phone,
        //   city: payload.billing_address.city,
        //   zip: payload.billing_address.zip,
        //   countryCode: payload.billing_address.country_code,
        //   provinceCode: payload.billing_address.province_code
        // },
        
        lineItems: lineItems
      }
    }
  };

If you try this mutation with the GraphiQL app, does this highlight any possible errors? GraphiQL for the Admin API

It is successful without any errors.

That’s great, now we can check what is different with your app. EG: are there scopes that are required which are not on your app?

When creating a new order using the GraphQL API, I noticed that if I pass the customer ID, the shipping and billing address, along with the customer’s name, do not get populated after the order is created. However, according to the documentation, these details should be automatically filled in from the customer’s default address.

To work around this issue, I stopped passing the customer ID and instead requested access to protected customer data. This allowed me to retrieve the necessary information separately and manually populate the shipping and billing address fields when creating the order.

It seems that the GraphQL API does not automatically pull the shipping and billing information from the customer’s default address when a customer ID is provided.