Versions Compared

Key

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

...

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

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

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

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

...

Example:

Code Block
languagejs
<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>