Promo Code Event
When a user issues a promo code through an embedded landing page our <script>
will fire a custom
event for you to hook into. This can be utilized to automatically apply the code for the user in
checkout.
To utilize this event you can use the following in your JavaScript code:
window.addEventListener('sbCodeCallback', (callbackData) => {
const { code } = callbackData.detail
// You can do whatever you need to do with the `code`
})
callbackData
is an object with the following properties:
{
detail: {
code: 'example_code'
}
}