Tixify Shop - Widget API
To get started with using the Shop Widget, make sure to add the following code to the head or body of your document:
Then, initialize the shop widget with the following code:
Now, reload the page and the shop bubble should be visible in the bottom right corner. The shop is now succesfully initialized.
It's possible to change how some things work.
The widget has a default margin of 16px to the top and bottom of the page.
However, the possibility exists that this places the widget on top of other components, such as a fixed header or footer.
By setting a css custom property, these margins can easily be changed. (Note that the variable needs to be visible by the widget and therefore be either on the root or body level.)
The widget has a default position on the z-axis (z-index) of 1050.
This value has intentionally been chosen to NOT be too high as to not limit the developer's options.
However, by setting a css custom property on the main website, this value can be easily changed. (Note that the variable needs to be visible by the widget and therefore be either on the root or body level.)
The widget propagates notifications to the host page so they are always visible.
By default, the z-index of these notifications is determined by the z-index of the widget itself plus 49, to ensure the notifications appear above the widget.
However, by setting a css custom property on the main website, this value can be easily changed. (Note that the variable needs to be visible by the widget and therefore be either on the root or body level.)
There are multiple functions that can be called to interact with the shop from outside the shop.
Increases the selection for the specified ticket by 1.
Syntax
Parameters
guid | Required. The guid of the ticket that needs to be added. |
---|
Decreases the selection for the specified ticket by 1.
Syntax
Parameters
guid | Required. The guid of the ticket that needs to be removed. |
---|
Adds the specified coupon to the shop checkout.
Syntax
Parameters
code | Required. The code of the coupon that needs to be added. |
---|
Removes the specified coupon from the shop checkout.
Syntax
Parameters
code | Required. The code of the coupon that needs to be removed. |
---|
Opens the shop widget.
Syntax
Closes the shop widget.
Syntax
Toggles the visibility of the shop widget popup.
Syntax
There are multiple events. They can be listened to by registering a callback.
Is called when the widget is opened or closed. Receives a boolean which indicates if the widget is opened or closed.
Syntax
Callback Parameters
Name | Type | Example value |
---|---|---|
opened | Boolean | true |
Is called when the ticket selection changes in the shop. Receives an object containing the count of selected tickets.
Syntax
Callback Parameters
Name | Type | Example value |
---|---|---|
tickets | Object | {
"b15754c0-0f05...": {
"selected": 3
}
} |
Is called when the total order price changes in the shop. Receives the total price formatted according to the shops locale.
Syntax
Callback Parameters
Name | Type | Example value |
---|---|---|
totalPrice | String | € 15,20 |
Is called when the total order price changes in the shop. Receives the total price in minor units and the shops currency.
Syntax
Callback Parameters
Name | Type | Example value |
---|---|---|
totalPrice | Integer | 1520 |
currency | String | EUR |
Thanks for reading, if you have feedback or questions about these guides, please contact us at [email protected] .