Skip to content

Add Bolt buttons to your Shopify theme

Install the Bolt script in your Shopify theme and place Bolt buttons in the cart drawer, on the cart page, and on the product page.

Bolt renders its storefront button from one script and a few theme snippets. Selecting the button opens the Checkout Everywhere checkout link for the shopper's cart. You add the script and snippets in the Shopify code editor and the theme customizer. The file names and CSS classes below match Shopify's Dawn theme; other themes use different names.

Prerequisites

  • Your store is connected to Bolt. See Connect Shopify to Bolt.
  • The checkout link host and merchant ID that Bolt provides during onboarding.
  • Shopify admin access that can edit theme code.

1. Prepare for installation

  1. Log in to the Merchant Dashboard, select Administration > API, and copy the Publishable Key.
  2. In your Shopify admin, go to Online Store > Themes. Shopify theme list with the current theme
  3. Find your current theme, open the three dots menu, and select Edit code. Theme context menu with Edit code

Expected result: The theme code editor opens with the Layout and Snippets folders in the sidebar.

2. Add code snippets

Create Bolt icon

Store the Bolt logo in a snippet so each button can render it.

  1. Under Snippets, select Add a new snippet.
  2. Name it bolt-icon.liquid and paste:
HTML
<svg width="32" height="32" viewBox="0 0 490 500" fill="none" xmlns="http://www.w3.org/2000/svg">
  <g>
    <path d="M243.398 214.363V125.272H225.6
             C210.293 179.084 180.746 238.598 145.86 285.637
             H247.669V374.728H265.467
             C280.774 320.917 310.321 261.402 345.207 214.363
             H243.398Z" />
  </g>
</svg>

Install global scripts

  1. Open layout/theme.liquid.
  2. Paste the following inside the <head> tag. Replace {PUBLISHABLE_KEY} with your publishable key, and {HOST} and {MERCHANT_ID} with the values Bolt provided during onboarding.
HTML
<link rel="stylesheet" href="https://c.boltapp.com/shopify/bolt-button.css">
<script
  src="https://c.boltapp.com/shopify/bolt-button.js?v="
  data-publishable-key="{PUBLISHABLE_KEY}"
  data-checkout-link-host="{HOST}.c.boltapp.com"
  data-merchant-id="{MERCHANT_ID}"
  defer="defer">
</script>
  1. In the same file, add the following attribute to the <body> tag. The script does not render buttons without it.
HTML
<body data-bolt-button-always-on="true" ... >

theme.liquid with the Bolt script in the head and the body attribute

3. Add Bolt Checkout buttons

Place a button in the cart drawer and on the cart page. Search each file for class="cart__ctas" to find the existing checkout buttons.

Cart drawer snippet

cart-drawer.liquid
<button data-bolt-buy-mode="cart-drawer" class="bolt-buy-button button button--full-width button--large">
  {% render 'bolt-icon' %}
  <span>Bolt Checkout</span>
</button>

Main cart page snippet

main-cart-footer.liquid
<button data-bolt-buy-mode="cart" class="bolt-buy-button button button--full-width button--large cart__checkout-button">
  {% render 'bolt-icon' %}
  <span>Bolt Checkout</span>
</button>

Product page checkout button

Add the product page button in the theme customizer.

  1. Go to Themes > Customize. Customize button on the theme card
  2. In the top navigation dropdown, select Products > Default product. Default product template selection
  3. In the left navigation, go to Template > Product information. Product information section in the template tree
  4. Under Buy buttons, select Add block, then Custom Liquid. Add block menu with Custom Liquid
  5. Paste the following into the Custom Liquid field and save.
Custom Liquid
<div class="product-form__input">
 <button data-bolt-buy-mode="buy-now" class="bolt-buy-button button button--full-width button--large">
   {% render 'bolt-icon' %}
   <span>Bolt Checkout</span>
 </button>
</div>

Test your website

  1. Open your storefront and add a product to the cart.

    Expected result: The Bolt button appears in the cart drawer, on the cart page, and on the product page.

  2. Select the button and complete a checkout.

    Expected result: The Bolt checkout link opens, and the completed order appears under Transactions in the Merchant Dashboard and as an order in Shopify.

Optional dashboard configuration

Alternative payment method configuration

  1. Log in to the Merchant Dashboard.
  2. Go to Payments and choose the payment method.
  3. Complete the payment method configuration.

Google Analytics / Facebook Pixel configuration

  1. In the Merchant Dashboard, go to Settings > Checkout.
  2. Select the Analytics tab.
  3. Enter your Google Analytics Tracking ID or Facebook Pixel ID.
  4. Select Save.

On this page