Home Getting Started How to install a checkout widget using JavaScript

How to install a checkout widget using JavaScript

Last updated on Jun 25, 2025

Embed a checkout widget on your website (Ideal for Shopify and Squarespace).

You can put a checkout widget on your website using WeTeachMe Embed JS API. If you need help with this, contact support@weteachme.com.

How-to video for a Shopify Website - click here.

1. Including the Javascript File

Add the below script to the head section in the page HTML.

<script src="https://d26lh3frdun17.cloudfront.net/wtm_embed.js" data-turbolinks-track="reload"></script>

Note: Attribute data-turbolinks-track is not necessary if your website is not using turbolinks.

2. Creating a Popup Checkout Widget

Using the following HTML/Javascript code to add a "Buy Now" button on the webpage, when clicked shows the checkout flow.

<button class="your-own-class wtm-book-button" data-token="1002105">Book Now</button>
<script>
  window.wtmEmbedJS({
    ele: ".wtm-book-button", // css query selector
    key: "best-school" // WeTeachMe Username
    listing: 1002105 // Listing ID (optional if using data-token on the button
  });
</script>

To embed multiple checkout widgets on the same page, use the "data-token" attribute. Just make sure the value for "data-token" is a valid listing id from the same account. If both "listing key" and "data-token" are specified, only "listing key" will be used.

Related Articles