Configuration
If you haven't already, make sure you publish the addon's config file - you'll need to do this:
1php please vendor:publish --tag=cargo-australia-post-config
When you have published the configuration file, you can find it in /config/cargo-australia-post.php. This is where you can:
define your available Service Codes for domestic and international shipping
adjust caching behaviour
define your Blueprint field mappings
define your "from" postcode, required for calculations to work
tweak your .env API key variable name (if you wanted)
The comments in the config file should help you set up your configuration with ease.
service_codes
The service_codes array includes two properties:
domestic
international
Each of these allows you to put in a key/value pair of Australia Post Service Code, with the label that you want to appear within your store.
This would allow Parcel Post and Express Post for domestic shipping, and Standard, Express and Courier for international:
1'service_codes' => [ 2 3 'domestic' => [ 4 'AUS_PARCEL_REGULAR' => 'Parcel Post', 5 'AUS_PARCEL_EXPRESS' => 'Express Post', 6 ], 7 8 'international' => [ 9 'INT_PARCEL_STD_OWN_PACKAGING' => 'Standard',10 'INT_PARCEL_EXP_OWN_PACKAGING' => 'Express',11 'INT_PARCEL_COR_OWN_PACKAGING' => 'Courier',12 ],13 14],
You can get the Australia Post service codes via commands as part of this addon.
mappings
The mappings array defines a number of properties that the addon requires to operate correctly.
The mapping keys must remain - but the values for each are the field handle to collect the dimension attributes.
The default config looks for a field called "height". If you had a different field, such as "package_height", you would change the config below to be:
1'height' => 'package_height'
from_postcode
This defines your "from" postcode that is used with the Australia Post PAC to help calculate costs to the customer's destination.
You can also set this with AUSTRALIA_POST_FROM_POSTCODE in your .env file.
api_key
You can set your Australia Post PAC API Key here.
The default setting will look for the AUSTRALIA_POST_PAC_KEY key in your .env file.
cache
To avoid unnecessary calls to the Australia Post PAC API, requests are cached by their parameter.
By default, this is for 5 minutes only.
You can adjust this value as needed, or set to 0 to disable caching:
1'cache' => [2 'ttl' => 300,3],