Skip to main content

How To - Shopify Integration

Steps to integrate Bloody Good Tests (BGT) with Shopify

Christie avatar
Written by Christie
Updated over a year ago

💡 This document outlines the steps to integrate Bloody Good Tests (BGT) with Shopify. This will allow you to sell a test bundle directly via your Shopify or Webflow ecommerce store for your customers to then automatically be invited to the BGT platform and receive their referral.

This means that every person who buys a test through your Shopify store will automatically also be added to your Practitioner Organisation account as a new customer.

The benefit of this approach is that you can sell your products directly through BGT, or via your shopify store, or even sell the same product through a second Shopify store under a different price/name etc.

Please note: You must have a practitioner account to access the Shopify integration feature. Click here to request a practitioner account.

Prerequisites

You will need to have completed the following steps before you can configure your Shopify integration.
​

Create a Practitioner Organisation with valid billing setup

You will need to have a Shopify store.


The Setup

💡 The following steps are for production, but can be mirrored for staging. If you wish to test this integration with a development store first, you can do so by creating a Shopify Development Store, and setup an account on the staging BGT account.

The steps in this configuration are grouped into 3 different groups:

  1. Creating the products (bundles) within BGT that you’re selling on your Shopify page

  2. Creating a store with BGT which handles the configuration of your external store (ie, Shopify requires a signing secret to be configured)

  3. Mapping the internal product to an internal store with an external ID (Shopify ID).

Step 1 - Create your test bundle

Here you will create the tests inside BGT that mirror the tests you offer on your Shopify account. For example if you sell a Testosterone Test on Shopify, you need to create that test in BGT using the test builder.

  1. Navigate to your organisation page (top right → select your organisation)

  2. Click “Tests” on the left, this will open up the test bundle builder.

  3. Select what tests you’d like to add to your product and hit continue

  4. Give it a name/description and toggle if you’d like to use this as a foundation test for other tests, hit “Save as template”.

    1. You HAVE TO save a bundle as a template if you want to use it as part of the Shopify integration or API.

  5. Repeat this process for all the tests you’d like to create

    1. You’ll need one test per product you list on your shopify page.

Detailed How-to guide here: How to - Create a Practitioner Test Bundle

Tip: Create your bundles with the same names as you have called them on your Shopify store, that way it is much easier for you to link them up.

Step 2 - Create your Store in BGT

Once you've created your test bundles you will now need to create a store within BGT.

Think of this as a “store configuration” for your external store. For example, if you only have one external store, which is a Shopify store, then you’ll only need one BGT store configured. But if you sell the same product on two different stores, ie a Shopify & Webflow store, then you’ll need to configure two BGT stores.

  1. Navigate to your organisation page (top right → select your organisation)

  2. Click “Settings” on the left menu

  3. Click “Integrations”

  4. Click “Configure new store”

  5. Select your store provider, give Store Name and if you’d like to change the store id, you can customise it here. Note: it can’t be changed once you have picked it.

  6. The Store Signing Secret is a value you’ll need to get from your Shopify store settings. The reason we need this is to confirm that the event we received from you is actually from your store, so that other stores can’t use your organisation configuration in BGT, and subsequently bill your account.

    1. To get your signing secret, log into your Shopify store

    2. Then select “Settings” (bottom left)

    3. Then select “Notifications”

    4. Then select “Webhooks”

    5. On this screen you’ll see something that says “Your webhooks will be signed with” and then a long hash. This is your signing secret and this is what you need to place in your store configuration in BGT.

    6. Copy this and paste it into your BGT store configuration

    7. Leave the Shopify tab open as we will be using it again soon.

  7. You can now click “Add” to add your store configuration

  8. Your integrations page should now look something like this:

Step 3 - Associate a Test Bundle (product) with your Store on BGT

This is the critical part of the setup. It maps your Shopify Product to an internal BGT test bundle that is configured as part of your organisation.
​
This allows us to:
a.) Understand what the user has ordered in order to generate a referral
b.) Charge the correct price for the requested test

Because you could technically sell the same BGT Product through different stores, you’ll need to associate a BGT bundle/product with a BGT store, and also give it the external id. This external id is the magic glue between your store and BGT being able to process the sale.

  1. Navigate to your BGT organisation page (top right → select your organisation)

  2. Then click “Settings”

  3. Click “Integrations”

  4. Click on your newly configured store

  5. Click “Add saved bundle to store”

  6. Now you can pick your created bundle on the left, and associate it with your external store product id.

    1. First pick a bundle on the left

    2. Now we need to navigate to your Shopify admin page to find the corresponding id.

    3. Select “Products”

    4. You should see all your store products here. Click into the product that matches the bundle you selected in step 6a.

    5. The URL in the address bar will now show an id. This is your product ID that you need to put into BGT. So copy/paste this in as the external ID in BGT.

    6. Repeat step 6 until you’ve configured all the products you’d like to be able to sell via BGT.

  7. Hit “Add products to store”

Step 4 - Configure the Webhook in Shopify to point to BGT

Now that you have setup a Store, Products and the mapping/association in BGT. You can configure Shopify to actually send the sales to BGT for processing when they happen. In order to complete this, you will need your webhook URL from BGT ready to setup in Shopify.

  1. In BGT, navigate to your organisation page (top right → select your organisation)

  2. Click “Settings”

  3. Click “Integrations”

  4. Then click your store

  5. Scroll down until you see “Webhook configuration”

  6. Hit the “Copy” button on the Webhook URL. This is the webhook URL you’ll need to add to shopify.

    1. And then select “Settings” in Shopify (Bottom left)

    2. Then select “Notifications”

    3. Then “Webhooks”

    4. Then click “Create webhook”

    5. In the dialog that opens, paste the webhook URL into the “URL” field.

    6. Under “Event”, select “Order payment” and the API Version should be “2024-10 (Latest)”

  7. Test a sample transaction by producing a sale on your Test store

  8. You have now completed your integration.

🚨 All of this is configurable/testable with our staging environment, we encourage you to try there first before moving to production

How it works - Simplified

  1. Customer Purchases Test bundle on Practitioner Shopify Store →

  2. Customer and Test bundle details are sent to BGT via webhook →

  3. BGT verifies the product and bills Practitioner account automatically →

  4. Customer is invited to create an account with BGT and a referral is generated →

  5. Results are sent to Customer and Practitioner pages.

Did this answer your question?