Expivi Shopify Embedding

Note: The embed functionality is not a standard functionality as it needs custom work to get the add-to-cart to work, this is supported for Enterprise clients only. Please be aware it might break your Shopify webshop and Expivi is not responsible for any incorrect integration.

Getting ready

You will need to have an account on Expivi before you start.
To get your Expivi account ready, please head to www.expivi.com and request yours now.

This document also assumes that your Shopify store and products have already been set up.

Creating Expivi products

  • Prepare the products you want to connect on Expivi.
  • Expivi offers many customization and configuration possibilities.
  • To learn more about how to setup your products inside Expivi, head to our Youtube channel.

How to integrate Expivi viewer and options embedded within a Shopify theme product page.

To integrate the Expivi viewer and the options within a Shopify theme product page you need to do the following 6 steps.

  1. Follow the steps 1-3 as described in this Shopify integration document
  2. Add HTML tags to the theme.liquid
  3. Copy expivi-embedded code into your theme.
  4. Add Metafields Guru plugin to your theme.
  5. Add metafield to Shopify product to connect Expivi product.
  6. Change your product-template.liquid to include the new expivi-embedded.liquid code.

1. Follow the steps 1-3 as described in Shopify integration document

These steps explain how to setup the Expivi Shopify plugin that is required to integrate the embedded version of the Expivi viewer and options. Make sure to follow these steps carefully so you are prepared for the further steps.

2. Add HTML tags to the theme.liquid

Integrating Expivi with your Shopify storefront requires some modifications to the theme files of the theme you’re using for your Shopify storefront. If you have no knowledge to do this yourself, please ask a developer to do this for you.

Note: Be aware that each theme has its own unique code, so the instructions below should be used as an example.

Go to Online Store > Themes and select Edit code in the Actions drop down menu. You’ll be taken to the template files editor.

Figure 1

In order to have the Expivi configurator function properly, a few scripts need to be added to the <head> tag in your theme.liquid file.

2.1 adding the <meta> tag

Firstly, a meta tag needs to be added to tell the Expivi plugin that you are using the embedded version, by adding the following line.

<meta name="expivi-embedded" content="true">

2.2 adding the <link> tag

Secondly you need to add the style of the ExpiviComponent by adding the next line:

Replace {api_asset_url} in the following code snippets with the provided asset URL that you got from the Expivi support team.

<link href="{api_asset_url}/ExpiviComponent.css" rel="stylesheet" />

2.3 adding the <script> tags

Lastly, some scripts need to be added to make the Expivi configurator function properly. These script also need to be added to the <head> tag.

<script src="{api_asset_url}/vendor.lib.js"></script>
<script src="{api_asset_url}/index.js"></script>
<script src="{api_asset_url}/ExpiviComponent.js"></script>

After you have done this, your theme.liquid should look like something like this:

Figure 2

3. Copy Expivi-embedded code into your theme.

To add the Expivi 3D configurator to your product page you need to add a new file to your theme. This file needs to be named expivi-embedded.liquid added to the snippets folder. You can do this by following the following steps:

3.1 Go to your theme file explorer ‘snippets’ folder

Figure 3

3.2 Click on ‘add a new snippet

Figure 4

3.3 Enter the name ‘expivi-embedded’ and press ‘Create snippet’.

Figure 5

Afterwards you need to copy the following code to the newly created file.

Replace {api_key} in the following code snippet on line 61 with the API key that you generated from the Expivi backend (https://admin.expivi.net/). It should also be sitting in the ‘API key’ input field on the Expivi shopify plugin.

<div class="expivi-single-product-container">
  <div class="expivi-viewer-container">
    <div id="viewerContainer"></div>
  <div class="expivi-option-container">
    <div id="priceContainer"></div>
    <div id="optionsContainer"></div>
  <button class="btn expivi-add-to-cart" id="embedded-add-to-cart-btn" data-product-id="{{ product.id }}" data-url="/cart" data-expivi-save>
    Add to cart

	.expivi-single-product-container {
    	display: table;
		height: 500px;
		width: 100%;
    .expivi-single-product-container .expivi-viewer-container {
		display: table-cell;
		width: 64%;
		padding-right: 15px;
		vertical-align: top;
	.expivi-single-product-container .expivi-viewer-container #viewerContainer {
      	display: block;
      	min-height: 100%;
    .expivi-single-product-container .expivi-option-container {
		height: 100%;
      	display: table-cell;
      	width: 36%;
    .expivi-add-to-cart {
      float: right;
    @media (max-width: 600px) {     
      .expivi-single-product-container {
        display: block;
        height: unset;
      .expivi-single-product-container .expivi-viewer-container {
        display: block;
        width: 100%;
        padding-right: 0;
        height: 50vh;
      .expivi-single-product-container .expivi-option-container {
        height: initial;
        display: block;
        width: 100%;
<script type="text/javascript">
  var apiToken = '{api_key}';  
      window.expiviInstance = ExpiviComponent({
        catalogueId: {{product.metafields.expivi.product_id}},
        viewerContainer: "#viewerContainer",
        optionContainer: "#optionsContainer",
        priceSelectors: '#priceContainer',
        token: apiToken

4. Add Metafields Guru plugin to your theme.

If you already have ‘Metafields Guru’ added to your theme you can skip this step.

Go to https://apps.shopify.com/metafields-editor-2 and click ‘Add app’. If you are not yet logged into the shopify app store, there will be a prompt to login. Please login and afterwards you will be met with the page below. Press install app to add the Metafields Guru plugin to your theme. In the next step you will setup this plugin for the Expivi 3D configurator.

Figure 6

5. Add metafield to Shopify product to connect Expivi product.

Navigate to your Shopify product that you connected with an Expivi product in step 3 of Shopify integration document. Under the ‘More actions’ dropdown you will find an option that says ‘Edit Metafields’.

Figure 7

Once you click on that you can add a new metafield to this product by clicking ‘Create Metafield’. This is necessary for the distinguishment between an Expivi 3D configurator on the product page or a standard visualization on the product page.

create the new metafield as follows. Make sure that the key is called ‘product_id’ (the underscore between product and id is mandatory). Fill in ‘Expivi’ as the namespace. As for the actual value, you want to use the ID that is in the Expivi backend. You can find this under Catalogue in the table as seen in the picture below.

Figure 8

Eventually, when you have filled everything in, it would look something like this:

Figure 9

Don’t forget to save your changes by pressing the save button displayed above.

6. Change your product-template.liquid to include the new expivi-embedded.liquid code

This following change is very dependent on your theme and can look a little different compared to the example. We need to add a check on the product page to see if we should load the embedded Expivi 3D configurator or if we should show the standard visualization.

The code looks like this:

{% if product.metafields.expivi.product_id %}
  {% include 'expivi-embedded' %}
  <div hidden style="display:none!important;">
{% else %}


{% if product.metafields.expivi.product_id %}
{% endif %}

Depending on how you implement it, it would result in the following:

Figure 10
Figure 11

As you can seen in the images above the first part of the code is there from line 8 until line 10. After that the standard visualization is implemented. The last part of the code ( the {% endif %}) is put on line 262 after the implementation of the standard visualization.

The result

If you have done everything according to these steps you should see an embedded viewer of the product that you have connected on that product page. It will look like something like this:

Figure 12

Well done!

You’ve successfully integrated the Expivi 3D configurator in your Shopify store!