A 3D configurator
on WooCommerce.
2 lines of code.
<viewer-3dvue> is a native Web Component. No dependencies, no additional plugin. It integrates into any WooCommerce template : single-product.php, a shortcode, or a custom Gutenberg HTML block.
add_action('wp_enqueue_scripts', function() { wp_enqueue_script( 'viewer-3dvue', 'https://cdn.jsdelivr.net/gh/3dvue/api@v4/viewer-3dvue-min.js', [], null, true ); });
<viewer-3dvue name="monViewer" src="https://app.3dvue.fr/view?p=AB01-CD02" ></viewer-3dvue> <!-- That's it. -->
Ready in 3 steps. No dedicated plugin.
A native Web Component : no React, Vue, or jQuery dependency. Compatible with all WordPress themes and page builders (Elementor, Divi, Bricks).
-
1Register the script
Use
wp_enqueue_script()in yourfunctions.phpto load the component. The finaltrueloads it in the footer : recommended to avoid blocking rendering.The CDN script above is public. You can also include it via an Elementor HTML widget or WPCode : in all cases, thesrcattribute on the component is the URL specific to your configurator, provided by 3DVue at delivery.functions.phpadd_action('wp_enqueue_scripts', function() { wp_enqueue_script( 'viewer-3dvue', 'https://cdn.jsdelivr.net/gh/3dvue/api@v4/viewer-3dvue-min.js', [], null, true ); }); // Or via WPCode : HTML snippet // <script src="https://cdn.jsdelivr.net/gh/3dvue/api@v4/viewer-3dvue-min.js"></script>
-
2Place the component
Paste the tag in your product template, in a PHP shortcode, or in a Gutenberg HTML block. Two required attributes:
name(unique identifier) andsrc(your configurator URL provided by 3DVue).With Elementor, simply paste the tag in an HTML widget. Since the script is already loaded globally, no additional configuration is needed.single-product.php or HTML widget<viewer-3dvue name="monViewer" src="https://app.3dvue.fr/view?p=AB01-CD02" ></viewer-3dvue> <!-- With debug enabled --> <viewer-3dvue name="monViewer" src="https://app.3dvue.fr/view?p=AB01-CD02" debug ></viewer-3dvue>
-
3Connect WooCommerce variations
Add the
viewer-3dvueattributes on your native WooCommerce<select>variation elements or on your custom swatches. The component listens automatically : no JS to write.variable.php : colour variation select<!-- On an existing WooCommerce select --> <select name="attribute_pa_colour" viewer-3dvue="monViewer" viewer-3dvue-change="setMaterial" viewer-3dvue-mesh="1,2" > <option value="0n">Black</option> <option value="1a">White</option> <option value="2b">Natural oak</option> </select> <!-- Or on a custom swatch button --> <button viewer-3dvue="monViewer" viewer-3dvue-clic="setMaterial" viewer-3dvue-meshs-materials='{"1":"2b","3":"0n"}' >Oak / Black</button>
Zero JavaScript.
All in HTML attributes.
The component automatically listens to click and change events on any element carrying the right attributes. Compatible with native WooCommerce selects and swatch plugins (Variation Swatches, etc.).
<button viewer-3dvue="monViewer" viewer-3dvue-clic="setMaterial" viewer-3dvue-meshs-materials='{"1":"0n","3":"2b"}' > Grey velvet fabric </button> // {"meshIndex": "materialId"} // Index 0 reserved : starts at 1
<select>. The viewer syncs automatically.<select name="attribute_pa_colour" viewer-3dvue="monViewer" viewer-3dvue-change="setMaterial" viewer-3dvue-mesh="1,3" > <option value="0n">Black</option> <option value="1a">White</option> </select> // viewer-3dvue-mesh="1,3" // applies to mesh 1 AND mesh 3
For advanced use cases.
Full programmatic control : useful for synchronising the viewer with WooCommerce variations via JS, or for advanced use cases like image capture or BAT export.
const viewer = document.querySelector('viewer-3dvue[name="monViewer"]'); // Sync with WooCommerce variations document.querySelector('.variations select') .addEventListener('change', (e) => { viewer.setMaterial({ "1": e.target.value }); });
// On object 0 (default) viewer.setMaterial({ "1": "0n", "3": "2b" }); // On a specific segment (multi-part product) viewer.setMaterial({ "1": "1a" }, 1); // setMaterial(materialList, objectIndex = 0)
// Load a different model (e.g. shape change) viewer.loadModel("AB01-CD02"); // Add a component to the existing model // E.g: add an armrest, a shelf, a leg viewer.addModel("EF03"); // Remove a component (index starts at 0) viewer.removeModel(1); // ⚠ Cannot remove the last remaining segment
viewer.captureToBase64(); viewer.addEventListener("onCaptureBase64Complete", (e) => { const { base64, error } = e.detail; if (error) return; // Store in a hidden field for the WC order document.querySelector('input[name="config_preview"]').value = base64; });
Text, logos, proofs.
All in SVG.
The SVG API lets you add text and images directly onto the 3D product via dropzones defined in the model. Used for customisable products : marking, logo upload, text engraving.
| Method | Description |
|---|---|
addSVGText(text, opts) |
Adds text to a dropzone. Options: fill, fontFamily, selectable |
addSVGImage(source, opts) |
Adds an image (File or ArrayBuffer). Zero-copy via Transferable Objects. |
setSVGElementParam(param, value, id) |
Modifies a parameter of an SVG element. Without 3rd argument: applies to the selected element. |
removeSVGElement(id) |
Removes an SVG element (text or image). Without argument: removes the selected element. |
exportSVG() |
Generates the SVG file of the configured product : print-ready proof. |
// 1. Upload logo from a WooCommerce file input const file = input.files[0]; viewer.addSVGImage(file, { dropzone: "dropzone001", selectable: true }); // 2. Custom text (engraving, marking) viewer.addSVGText("My text", { fill: "#ffffff", fontFamily: "Arial" }); // 3. Export the SVG proof for production viewer.exportSVG(); viewer.addEventListener("onSVGExportComplete", (e) => { const { path } = e.detail; // path = URL of the print-ready SVG file });
Further reading
This configurator in your sector
API reference, HTML attributes, events, WooCommerce PHP examples. Everything is documented and kept up to date.
View documentationNo automated ticketing. You speak directly with Matthieu, the developer who designed the API. Response within 24 hours.
Book a callTest the configurator in real conditions before integrating. See exactly what your customers will see on your WooCommerce store.
View demoReady to integrate?
We handle the 3D models.
You manage the code on the WooCommerce side, we handle everything else : modelling, materials, configuration. In 30 minutes, we'll show you what we can do with your catalogue.