0

I want to change the shipping address and billing address for Magento 2 orders through the /order/{parent_id} endpoint:

https://adobe-commerce.redoc.ly/2.4.7-admin/tag/ordersparent_id

Parent_id is the (parent) Order ID of the address. This currently works for setting either the shipping or billing address. E.g. the body of my query in that case looks like this:

entity: 
{
 address_type: 'shipping',
 city: 'Tilburg ',
 company: undefined,
 country_id: 'NL',
 email: '[email protected]',
 entity_id: 1,
 fax: '',
 firstname: 'xxx',
 lastname: 'Bodden',
 middlename: '',
 parent_id: 1,
 postcode: 'xxx',
 prefix: '',
 region: undefined,
 street: [ 'xxx 181' ],
 suffix: '',
 telephone: '0123456789'
}

It seems that if you change either the billing or shipping address, the other resets to some default values. From this I naturally conclude that you should forward the complete address entity for both the shipping and billing, however the API does not seem to accept multiple addresses like this:

entity: {
{
 address_type: 'shipping',
 city: 'Tilburg ',
 company: undefined,
 country_id: 'NL',
 email: '[email protected]',
 entity_id: 1,
 fax: '',
 firstname: 'xxx',
 lastname: 'Bodden',
 middlename: '',
 parent_id: 1,
 postcode: 'xxx',
 prefix: '',
 region: undefined,
 street: [ 'xxx 181' ],
 suffix: '',
 telephone: '0123456789'
},
 {
 address_type: 'billing',
 city: 'Tilburg ',
 company: undefined,
 country_id: 'NL',
 email: '[email protected]',
 entity_id: 1,
 fax: '',
 firstname: 'xxx',
 lastname: 'Bodden',
 middlename: '',
 parent_id: 1,
 postcode: 'xxx',
 prefix: '',
 region: undefined,
 street: [ 'xxx 181' ],
 suffix: '',
 telephone: '0123456789'
}
}

I am confused to how I should call the endpoint to set both the shipping and billing address seperately. Does anybody here have a hint to what could work? Thanks!

asked Feb 17 at 14:36
1
  • can you try this API endpoint [PUT] /rest/V1/orderAddress/{addressId} you can get the data from [GET] /rest/V1/orders/{orderId} api Commented Feb 28 at 11:48

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.