Guide

How to add a 3D product configurator to BigCommerce

, imagine.io ·

The imagine.io Configurator Platform works on BigCommerce through a sharing link. Drop an HTML widget onto the product page in Page Builder, paste one iframe tag into it, and add your store's domain to the link's allowed domains in the imagine.io dashboard. The configurator loads with its own customisation options and live price, or with the panel hidden and your own buttons driving it. No app to install; the cart hand-off is a short script that calls BigCommerce's Storefront Cart API. On a headless storefront built in React, such as Catalyst, mount the SDK instead: the React guide.

1 THE LINKimagine.io dashboardScenes › Configurable Systems› Sharing Links: add your domain,then Copy embed code2 PASTE ITBigCommerceProducts › edit the product › ⋯View in Page builder › HTML widgetpaste the iframe, publish3 LIVEYour product page3D view, customisation options,live priceadd to cart through the bridgethe link carries its own catalog and theme; the page only frames it 1 THE LINKimagine.io dashboardScenes › Configurable Systems› Sharing Links: add your domain,then Copy embed code2 PASTE ITBigCommerceProducts › edit the product › ⋯View in Page builder › HTML widgetpaste the iframe, publish3 LIVEYour product page3D view, customisation options,live priceadd to cart through the bridgethe link carries its own catalog and theme;the page only frames it
Where the embed goes: the link is made in the dashboard, pasted into the BigCommerce editor, and the configurator renders inside the page.
This guide uses the embed route. One iframe, a sharing link, and the bridge for the cart. Your own buttons are already covered: hide the configurator's panel and drive it from the page through the bridge (step 5 below). Want to change the configurator itself, the parts inside the frame? Build it with the SDK, host that page, and embed it with the same iframe: the bridge activates on any page that mounts the SDK inside an iframe, so everything below about the cart works unchanged. All three routes: which route fits which site.

The embed code

One element. The configurator boots, loads its catalog and renders itself, with its customisation options and live price. Replace lk_YOUR_LINK with your sharing link.

<iframe
  id="configurator"
  title="Product configurator"
  src="https://configurator.imagine.io/lk_YOUR_LINK"
  style="width:100%; height:640px; border:0; display:block"
  allow="xr-spatial-tracking; fullscreen; clipboard-write"
  referrerpolicy="strict-origin-when-cross-origin"
  loading="lazy"></iframe>

Step by step

  1. Create the sharing link and allow your domain

    In the imagine.io dashboard open Scenes › Configurable Systems, pick the system, and on its Sharing Links tab create a link. Give it a name for where it will live, choose a theme or leave the default, and under Allowed domains add every domain the page will be served from. Leave the list empty while you test locally, and fill it in before you go live: a link embedded on a domain that is not listed shows a “not authorized” card instead of the configurator.

    Copy embed code on the row gives you the iframe below with the link filled in.

    The Sharing Links tab of a system, with one link showing its name, theme and allowed domains
    Scenes › Configurable Systems › Sharing Links. One link per place you use it; the allowed domains are set here.
  2. Add an HTML widget to the product page

    In the BigCommerce control panel open Products › All products and edit the product. Open the three-dot menu (⋯) at the top right and choose View in Page builder: Page Builder opens on that product's page. For any other page, open Storefront › Themes, choose Edit in Page Builder from the three-dot menu (⋯) next to Edit theme styles, and pick the page from the selector at the top.

    Drag an HTML widget from the widget panel to where the configurator should appear, and paste the iframe from above with your link in src. Then press Publish. BigCommerce's guide: Page Builder.

    Without Page Builder, edit the product under Products, switch the description editor to HTML source view, and paste the iframe there.

  3. Add a text field for the configuration

    The cart line carries the configuration in a product option. Edit the product, open Customizations in its left menu, and add a Text field named Configuration. Leave it optional, so the theme's own Add to Cart still works.

    The cart script needs two ids. The product id is the number at the end of the address bar while you edit the product (…/products/edit/123). The option id of the text field is in the live product page's source: its input is named attribute[456], and 456 is the id.

  4. Size it for the page

    The iframe takes the width of its widget. Give it a height that fits the product layout, 640px is a good start, or 80vh for a full-page experience. On phones the configurator lays itself out for the narrow width.

  5. Decide who owns the customisation options

    Keep the configurator's panel, or hide it with ?hide=sidebar on the link and drive the scene from your own swatches through the postMessage bridge. The 3D view stays.

    https://configurator.imagine.io/lk_YOUR_LINK?hide=sidebar

    With the panel hidden, your page sends the choices in. Wait for the frame to say it is ready, read the option sets to build your own swatches from, then select by name or by id. The ten-line callConfigurator helper is the one from the cart section below.

    const iframe = document.getElementById('configurator');
    
    window.addEventListener('message', (e) => {
      if (e.data?.type === 'configurator:ready') start();          // the frame is listening
    });
    
    async function start() {
      // Every option set and option, to build your own swatches from
      const sets = await callConfigurator(iframe, 'getOptionSets');
    
      // Your swatch -> the configurator. By name, or by id when your CMS stores ids
      await callConfigurator(iframe, 'selectOption', { optionSet: 'Fabric', option: 'Cognac' });
      await callConfigurator(iframe, 'selectOption', { optionSetId: 41, optionId: 118 });
    
      // Hide or show parts of the configurator's interface after boot
      await callConfigurator(iframe, 'hideUI', { regions: ['sidebar'] });
    }

    What you can pass and what comes back: the URL parameters (hide, gui, theme, project, config), the full protocol, every command with its payload and its real reply (select options, read the quote and the state, camera, interface regions, undo and redo), the events the frame sends out, and the helper. One thing to know: a command the frame accepts can still be refused by a rule a moment later, which arrives as an evaluate.rejected event, so roll a cart line back on that event, not on the command's reply.

  6. Add every domain you serve from

    BigCommerce serves your store on your-store.mybigcommerce.com and on your custom domain. Add both to the link's allowed domains, plus any preview domain you test on. The check reads the referrer, so keep the iframe's referrerpolicy at strict-origin-when-cross-origin or looser.

  7. Test on the store

    Open the product on the live domain, change a few options and watch the price. Then wire the cart below.

Hand the configuration to your cart

The bridge gives the page the itemised quote, a thumbnail and a snapshot of the build. The script below adds the product to the shopper's cart with BigCommerce's Storefront Cart API, on the store's own domain, with a summary of the configuration in the Configuration text field. Add it under Storefront › Script manager (location: footer, on store pages), or in the HTML widget under the iframe.

<button id="add-to-cart" disabled>Add to cart</button>
// Ten lines you write once: posts a command into the iframe and resolves with its reply.
function callConfigurator(iframe, action, payload) {
  return new Promise((resolve, reject) => {
    const requestId = 'req-' + Math.random().toString(36).slice(2);
    const onReply = (e) => {
      const m = e.data;
      if (m?.type !== 'configurator:response' || m.requestId !== requestId) return;
      window.removeEventListener('message', onReply);
      m.success ? resolve(m.data) : reject(new Error(m.error));
    };
    window.addEventListener('message', onReply);
    iframe.contentWindow.postMessage({ action, payload, requestId }, '*');
  });
}
const iframe = document.getElementById('configurator');
const add = document.getElementById('add-to-cart');

window.addEventListener('message', (e) => {
  const m = e.data;
  if (m?.type === 'configurator:ready') add.disabled = false;
  // The price follows every change the shopper makes. No polling.
  if (m?.type === 'configurator:event' && m.event === 'price.changed') {
    add.textContent = `Add to cart: ${m.data.currency} ${m.data.grandTotal}`;
  }
});

add.onclick = async () => {
  const quote      = await callConfigurator(iframe, 'getQuote');          // itemised, priced by the engine
  const { dataUrl } = await callConfigurator(iframe, 'getScreenshot');    // thumbnail for the cart
  const snapshot   = await callConfigurator(iframe, 'getConfiguration');  // reopen the exact build later
  const lineItems = [{
    productId: BC_PRODUCT_ID,                // the product that carries the configured item
    quantity: 1,
    optionSelections: [{
      optionId: CONFIGURATION_OPTION_ID,     // the Configuration text field
      optionValue: `${quote.system.name}: ${quote.lines.map((l) => `${l.name} (${l.selections.map((s) => s.optionName).join(', ')})`).join('; ')}`,
    }],
  }];
  // Add to the shopper's cart, or create one
  const [cart] = await (await fetch('/api/storefront/carts', { credentials: 'same-origin' })).json();
  await fetch(cart ? `/api/storefront/carts/${cart.id}/items` : '/api/storefront/carts', {
    method: 'POST',
    credentials: 'same-origin',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ lineItems }),
  });
  window.location.href = '/cart.php';          // snapshot and dataUrl: keep them on your server if you need them
};

What arrives in the cart: one line with the product's own SKU and the summary in its Configuration option, for example Sectional sofa: Corner unit (Cognac leather, Oak legs), which shows on the cart, the checkout and the order. The Storefront Cart API charges the product's own price, with any modifier price adjustments. To charge the engine's price from quote.totals.grandTotal, add the line from your server with BigCommerce's server-to-server cart API instead, which accepts a list_price for the line, and check the quote there before you trust it. The bridge chapter documents every field of the quote.

Frequently asked questions

Which 3D product configurators work with BigCommerce?

The imagine.io Configurator Platform works with BigCommerce. A sharing link is embedded with one iframe in a Page Builder HTML widget on the product page, and a short script sends the configuration to the cart through the Storefront Cart API. Headless BigCommerce storefronts built in React, such as Catalyst, can mount the SDK instead. Rules, constraints and pricing run on imagine.io's servers, so nothing is installed in the store.

Do I need a BigCommerce app?

No. The embed is one iframe in an HTML widget, and the cart hand-off is a short script on the store's own domain. Nothing is installed from the BigCommerce App Marketplace.

Can BigCommerce charge the engine's price?

Yes, from your server. The Storefront Cart API charges the product's own price; BigCommerce's server-to-server cart API accepts a list_price for a line, so your server can set it from quote.totals.grandTotal after checking the quote.

My site has a Content-Security-Policy. What does it need?

Allow the configurator origin in frame-src, for example frame-src https://configurator.imagine.io. The configurator host permits framing by the domains in the link's allowed domains, so add your site there too.

Can I use my own swatches instead of the configurator's customisation options on BigCommerce?

Yes. Add ?hide=sidebar to the link so the panel disappears, then call selectOption from your page through the postMessage bridge. getOptionSets returns every option set and option to build your buttons from. The SDK docs cover each command.

Troubleshooting

The page shows a “not authorized” card instead of the configurator.

The page's domain is not in the link's Allowed domains. Add it in Scenes › Configurable Systems › Sharing Links, including any preview or staging domain you test on. The check reads the referrer, so the iframe must not set referrerpolicy to no-referrer.

The configurator is blank, or the events arrive but every command times out.

Two usual causes. The page is opened from the file system rather than a web server: a file:// page has no origin the browser will deliver replies to. Or the iframe has a sandbox attribute that strips allow-scripts or allow-same-origin. Remove the sandbox attribute and serve the page over http.

Fullscreen or the Copy button does not work inside the embed.

The iframe needs allow="xr-spatial-tracking; fullscreen; clipboard-write". Without fullscreen the browser blocks the fullscreen toggle. Without clipboard-write in the iframe’s allow attribute, the browser blocks copying inside the configurator.

A licence notice appears on the real site but not in testing.

The free plan is for non-commercial evaluation with the imagine.io watermark. Running on your own domain and storefront is part of a paid plan; the plans are in the dashboard under Settings › Billing.

Other platforms

SDK documentation · Admin guide