Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • End users interact with the Visualizer’s shopping cart directly.

  • You cannot pre-populate the Visualizer cart with products from your website.

  • Whenever users add or remove items from the Visualizer cart, events are triggered, allowing you to synchronize these changes with your website’s cart.

Steps to enable the one-way shopping cart sync

  1. To enable the shopping cart functionality in your PIM account (Configuration → Web)

...

  1. Put a link to the shopping cart from your website

shopc2.pngImage Added

  1. Add integration code

Code Block
<script>
    document.addEventListener('DOMContentLoaded', () => {
        const visualizer = WizartDeploymentKit.createVisualizer({
            token: 'YOUR_WEB_TOKEN',
            targetElement: document.getElementById('visualizer-container'),
        });
        
        visualizer.load().then(() => {
            visualizer.show();

            // Subscribe to "add to cart" events
            WizartDeploymentKit.EventBus.subscribe(
                (event) => { 
                    // Add item to your website cart
                },
                WizartDeploymentKit.VISUALIZER_EVENTS.ADD_TO_CART,
                visualizer
            );

            // Subscribe to "remove from cart" events
            WizartDeploymentKit.EventBus.subscribe(
                (event) => { 
                    // Remove item from your website cart
                },
                WizartDeploymentKit.VISUALIZER_EVENTS.REMOVE_FROM_CART,
                visualizer
            );
        });
    });
</script>

...