Setting shipping address via customer endpoint

Hi,

We are trying to create a customer’s shipping address only and setting the address to be the default shipping address.

We have looked at your API: create-a-customer

The data we have tired is:

  • We’ve replaced real data with “dummydatahere”.

Example 1:
{"email":"accounts@test.co.uk)","phone":"","mobile":"","note":"","billing_address_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"},"shipping_address_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"}}

Example 2:
{"email":"accounts@test.co.uk)","phone":"","mobile":"","note":"","billing_address_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"},"shipping_address_attributes":[{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"}]}

Example 3:
{"email":"accounts@test.co.uk)","phone":"","mobile":"","note":"","billing_address_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"},"deliver_to_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"}}

Example 4:
{"email":"accounts@test.co.uk)","phone":"","mobile":"","note":"","billing_address_attributes":{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"},"shipping_addresses":[{"first_name":"dummydatahere","last_name":"dummydatahere","company":"","address1":"DO NOT SHIP","address2":"dummydatahere","city":"dummydatahere","country":"dummydatahere","zip":"dummydatahere"}]}

the API dose not specify the required format:

We have also reviewed the thread and it does not explain a solution for the customer endpoint.

Please could you review and confirm the format for the shipping address requirement?

Thanks,
Aj.

Hi @Ajesh, apologies for the delayed response.

Setting a default shipping address is only possible for wholesale customers only. If you want to create a wholesale customer, you can specify "customer_type": "business" within the customer object.

If you are creating a wholesale customer then you’ll also need to provide at a minimum a first name and email for the contact details.

The body of your request should look like the following:

{
  "customer": {
    "customer_type": "business",
    "contact_attributes": {
      "title": "Head Employee",
      "first_name": "Jeffrey",
      "last_name": "Dunningham", 
      "phone": "020 3999 999",
      "email": "test@example.com",
      "is_default": "true"
    },
    "email": "test@example.com",
    "phone": "",
    "mobile": "",
    "note": "",
    "company_name": "My Wholesale Customer",
    "billing_address_attributes": {
        "first_name": "Jeffrey",
        "last_name": "Dunningham",
        "company": "My Wholesale Customer",
        "address1": "...",
        "address2": "...",
        "city": "...",
        "country": "...",
        "zip": "..."
    },
    "shipping_address_attributes": {
      "first_name": "Jeffrey",
      "last_name": "Dunningham",
      "company": "My Wholesale Customer",
      "address1": "...",
      "address2": "...",
      "city": "...",
      "country": "...",
      "zip": "..."
    }
  }
}