Set Up Callbacks for BigCommerce

Bolt provides optional callbacks during the checkout process that can be used to trigger frontend analytics events. In our BigCommerce integration, callbacks should be defined in the same template file in which Bolt’s connect script is added.

How it Works

After connect-bigcommerce.js executes, a BoltCheckout object is available in global scope. window.BoltCheckout.setClientCustomCallbacks(callbacks) is a function with a single object argument with the following properties: check, onCheckoutStart, onEmailEnter, onShippingDetailsComplete, onShippingOptionsComplete, onPaymentSubmit, success, and close.

setClientCustomCallbacks() cannot be called until BoltCheckout is initialized during the execution of Bolt’s connect script. You should delay the execution using a setInterval method below:

  var callbacks = {
      check : function () {
          // Executes just before the checkout form loads.
          // Must return a boolean that will determine if Bolt should proceed with checkout.
          return true;
      onCheckoutStart : function () {
          // Executes after the checkout form is presented to the user
      onEmailEnter: function (email) {
          // Executes after the user enters their email address.
      onShippingDetailsComplete: function (address) {
          // Executes when the user proceeds to the shipping options page.
          // This is applicable only to multi-step checkout.
          // When available the first parameter will contain a user's name and address info.
      onShippingOptionsComplete: function () {
          // Executes when the user proceeds to the payment details page.
          // This is applicable only to multi-step checkout.
      onPaymentSubmit: function () {
          // Executes after the user clicks the pay button.
      success: function (transaction, callback) {
          // Executes when the Bolt checkout transaction is successful.
          // **IMPORTANT** callback() must be executed at the end of the success function
      close: function () {
          // This function is called when the Bolt checkout modal is closed.
          // This will not be called when create_order endpoint returns a valid URL
          // and authorization is successful
  var setupCallbacks = setInterval(function() {
      if (typeof(BoltCheckout) != 'undefined') {
  }, 100);


  • Callbacks are executed from your storefront domain, not Bolt’s IFrame
  • success() is the only required function; it must invoke the callback() method after completing custom code.
  • If redirecting to an order confirmation page, consider adding code to the close function, which checks if an order was completed.
📖On This Page