Guide

How to add a 3D product configurator to WordPress

, imagine.io ·

Paste one iframe tag into a Custom HTML block on any WordPress page, and add your site's domain to the link's allowed domains in the imagine.io dashboard. This guide covers a page on any WordPress site; for a WooCommerce product page and its cart, read the WooCommerce guide. The configurator loads with its own customisation options and live price, or with the panel hidden and your own buttons driving it. No plugin needed.

1 THE LINKimagine.io dashboardScenes › Configurable Systems› Sharing Links: add your domain,then Copy embed code2 PASTE ITWordPressedit the page+ › Custom HTML blockpaste the iframe, update3 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 ITWordPressedit the page+ › Custom HTML blockpaste the iframe, update3 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 WordPress 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 a Custom HTML block

    Edit the page in the block editor, press +, and choose Custom HTML. Paste the iframe from above with your link in src. Page builders work the same way: an HTML widget in Elementor, a Code module in Divi, a Raw HTML block in Bricks.

  3. Keep the HTML intact

    Some security plugins and user roles strip iframes on save. If the tag disappears, save the page as an Administrator, or allow the iframe tag for the role that edits pages. Caching and optimisation plugins that lazy-load iframes are fine; the configurator already loads lazily.

  4. Size it for the page

    The iframe takes the width of its container. Give it a height that fits your 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

    Add the live domain and any staging domain to the link's allowed domains. The check reads the referrer, so keep the iframe's referrerpolicy at strict-origin-when-cross-origin or looser.

Hand the configuration to your cart

The bridge gives your page the itemised quote, a thumbnail and a snapshot of the build. On a WordPress site without a store, hand them to a form (a quote request with the snapshot in a hidden field), a CRM, or your own backend. On a WooCommerce store, the cart line is covered in the WooCommerce guide.

<button id="add-to-cart" disabled>Request a quote</button>
<form id="quote-form" style="display:none"><input type="hidden" name="configuration"><input type="hidden" name="total"></form>
// 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
  // Hand it to a form plugin's hidden fields, or post it to your own endpoint
  const form = document.getElementById('quote-form');
  form.elements.configuration.value = JSON.stringify({ quote, snapshot });
  form.elements.total.value = `${quote.currency} ${quote.totals.grandTotal}`;
  form.requestSubmit();
};

The quote's lines carry every placed product with its chosen options already resolved to names, and totals.grandTotal is the engine's price. The bridge chapter documents every field.

Frequently asked questions

Do I need a plugin?

No. The embed is a Custom HTML block; nothing is installed. A WooCommerce store needs a few lines of PHP to carry the configuration onto the cart line, shown in the WooCommerce guide.

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 WordPress?

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 iframe disappears when I save the page.

WordPress strips iframes for roles without the unfiltered_html capability: for a Contributor, the block's content is sanitised and the iframe and script tags are removed on save. Some security plugins do the same for everyone. Save as an Administrator or Editor, or allow the iframe tag for the editing role. WordPress's own page on the block: Custom HTML.

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