Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2

One-way shopping cart synchronisation is a simple way to keep in sync the contents of the shopping carts (between the one in the Visualizer and the one on your website). This kind of synchronization implies that the details will be processed on your side. Upon clicking on the 'Proceed to checkout' button, the Visualizer will send the order details (SKUs and quantity) which you will need to forward to the shopping cart on your website.

Steps to enable the one-way shopping cart sync

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

  2. Put a link to the shopping cart on your website

Having completed the steps above, the ‘Proceed to checkout’ button must redirect a user to the following URL:

https://example.com/cart?vendorCode[]=wallpaper_1&quantity[]=2&vendorCode[]=wallpaper_2&quantity[]=1

Example:

<script>
  window.addEventListener("load", function(event) {
    // get parameters from url
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    
    // get values from query-string
    const sku = urlParams.getAll('vendorCode[]');
    const quantity = urlParams.getAll('quantity[]');
    
    // print the result
    console.log(sku); // ['wallpaper_1', 'wallpaper_2'];
    console.log(quantity); // ['2', '1'];
    
    // Next you need to put the sku and quantity
    // into the shopping cart on your website.
  });
</script>
  • No labels