Problem in Creating a new customer while creating an order

New Member
2 0 0

Hi, 

 

According to the "Create a partially paid order with a new customer and addresses" example in the https://help.shopify.com/en/api/reference/orders/order#create , the API is creating the customer with the first name and last name in the billing address JSON object, not with the first name and last name in the customer JSON object. 

 

The request contains the following in the example

"customer": {
      "first_name": "Paul",
      "last_name": "Norman",
      "email": "paul.norman@example.com"
    },
    "billing_address": {
      "first_name": "John",
      "last_name": "Smith",
      "address1": "123 Fake Street",
      "phone": "555-555-5555",
      "city": "Fakecity",
      "province": "Ontario",
      "country": "Canada",
      "zip": "K2P 1L4"
    }

The customer in the response is the following

"customer": {
      "id": 1073339476,
      "email": "paul.norman@example.com",
      "accepts_marketing": false,
      "created_at": "2019-04-09T10:56:31-04:00",
      "updated_at": "2019-04-09T10:56:32-04:00",
      "first_name": "John",
      "last_name": "Smith",
      "orders_count": 1,
      "state": "disabled",
      "total_spent": "199.00",
      "last_order_id": 1073459984,
      "note": null,
      "verified_email": true,
      "multipass_identifier": null,
      "tax_exempt": false,
      "phone": null,
      "tags": "",
      "last_order_name": "#1002",
      "currency": "USD",
      "accepts_marketing_updated_at": "2019-04-09T10:56:31-04:00",
      "marketing_opt_in_level": null,
      "admin_graphql_api_id": "gid://shopify/Customer/1073339476",
      "default_address": {
        "id": 1053317309,
        "customer_id": 1073339476,
        "first_name": "Jane",
        "last_name": "Smith",
        "company": null,
        "address1": "123 Fake Street",
        "address2": null,
        "city": "Fakecity",
        "province": "Ontario",
        "country": "Canada",
        "zip": "K2P 1L4",
        "phone": "777-777-7777",
        "name": "Jane Smith",
        "province_code": "ON",
        "country_code": "CA",
        "country_name": "Canada",
        "default": true
      }
    }

 

Is this a bug? If it is not, is there a way to create the customer with the first name and last name as I provided in the request? 

 

Thanks in advance!

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1137 24 162

This looks to just be a bug in the docs. When I create an order with a customer object and a billing address where both have a first_name and last_name, the customer object's first_name and last_name takes precedent which makes sense to me.

 

I'll look into fixing the docs, and let me know if you see anything to the contrary in your own tests.

0 Likes
New Member
2 0 0

Hi Alex,

 

Thanks for the reply but my tests show the same behavior as described in the docs. Creating a new customer with the first and last name in the billing address.

 

Looking forward to your response.

0 Likes