Get/update the destination address

🚧

A new version of the docs is available here

General

The destination address is used as the default destination for the ShipupETA.fetchPredictions method.
As the machine learning model prediction depends on the destination address, you should change the address of the ShipupETA library when the customer selects a shipping address.

Get the destination address

Use ShipupETA.destinationAddress to get the destination address.

Update the destination address

By default, the destination address will be the destination_country set in your Shipup back-office.
To change the default package destination address you can use any of the below 2 methods.

When initializing ShipupETA

ShipupETA.init({
  publicApiKey: 'my-public-key',
  defaultDestinationAddress: {
    country_code: 'FR',
  },
})
// Default destination address is now { country_code: 'FR' }
console.log(ShipupETA.destinationAddress)

Using changeDestinationAddress

ShipupETA.changeDestinationAddress({
  country_code: 'FR',
})
// default destination address is now { country_code: 'FR' }
console.log(ShipupETA.destinationAddress)