/
Below are utility methods you can use to integrate with your site.
Method | Returns | Description |
---|---|---|
zonos.isDomestic() | Boolean | True if the current country is domestic |
zonos.country() | String | Get the currently selected country code. |
zonos.country(code) | String | Set the country manually and return it. code should be a two-character ISO code. |
zonos.config(object)
is a method utilized by Hello. It can be set up to work with estimating quotes, converting currency, or redisplaying the Hello splash screen and moving the flag position. Depending on which of these you want to do, the object sent to config
changes:
Task: | Populate the config with the object like… |
---|---|
Estimating quotes | {detail: {items: [{id: "String", name: "String", price: Double / "String", quantity: Integer / "String", image: "String URL of image / Optional", hsCode: "String / Optional", category: "String / Optional", country: "String (country of origin) / Optional", SKU: "String / Optional"}], currencyCode: "String / optional default to USD", includedTaxRate: Double / optional default to 0}} |
Converting currency | {detail: {currencySelectors: ["css selector 1", "css selector 2"], customConverter: "custom function to convert the selectors / Optional, best to leave as default", showDecimal: boolean / Optional}} |
Redisplaying the Hello splash screen and moving the flag position | {detail: {location: "String options are: left, right, top, bottom, floating & attached / Optional", showSplash: boolean / Optional}} |
Hello events
z-country-change
This event will fire each time the country is changed, including the initial country selection. The event
detail
property will be an object that includescode
andname
.code
name
Hello integration script
{ "code": "US", "name": "United States" }
z-duty-tax-quote
This event will fire once a duty and tax quote response is received. The event
detail
property will be an object with the following properties:subtotal
taxOrVat
dutyTotal
dutyTaxTotal
taxOrVat
anddutyTotal
foreign
(premium)Hello integration script
{ "subtotal": 89.99, "taxOrVat": 18.0, "dutyTotal": 32.54, "dutyTaxTotal": 50.54, "foreign": { "currencyCode": "GBP", "subtotal": 89.99, "taxOrVat": 18.0, "dutyTotal": 32.54, "dutyTaxTotal": 50.54 } }
z-message-change
This event will fire each time the displayed Hello message is changed. The event
detail
property will be an object that includes themessage
.message
Hello integration script
{ "message": "<div>Welcome ...</div>" }