The JavaScript: Purchase Script - Cart Script

The Purchase Script enables the Size Advisor algorithm to learn and improve the recommendations it gives. The Purchase Script is a two-script combination of a cart and confirmation script. Here are instructions on the Cart Script:

The cart script needs to be implemented on the cart page or ajax cart section summarizing the items which the customer has added to their cart. Every time the cart is updated, the script must be executed again.

Click here to access the Cart Script


If your cart is an Ajax cart and is dynamically available on your webshop, you will need to add the additional scripts below.

Click here to access the Ajax Cart Script


Once finished, check if the following requirements below are met:

  1. Make sure the shoeID matches with the shoeID (Article ID) you provided in the Product Feed.
  2. Make sure to set the size in the correct format, only containing the numeric value. Good examples: "40", "40.5", "40.33", "40 1/3", "40 ⅓", "8.5", "8". Bad examples: "40 EU", "Size 40", "EU 42".
  3. Make sure the scale is set correctly: (eu, uk, us, etc).
  4. Make sure to set the quantity correct. If having the same item twice in the shopping cart, send one item with quantity "2" instead of two items with quantity "1".
  5. Make sure the price is set in the format "100.00" or "100".
  6. Make sure the cart script is executed every time a change to the cart is done. A change to the cart is for example:
  • Add a shoe
  • Remove a shoe
  • Change the size
  • Change the quantity

7. If there is no order number yet, leave it empty - pass an empty string: "".

How to test if it has been set up correctly

After having the cart script implemented, test if everything was set up correctly by adding one or more shoes to the shopping cart and see if the script is executed.

There should be an AJAX call to containing all the products in the cart. The response should be {"success" : true}.

If the response is {"success": false} or the server responds with status code 500, check if everything is set up correctly.


Need help? Contact us at