1. Help Center
  2. Size Advisor Onboarding for Brands
  3. The Scripts - Integrating the JavaScript

The JavaScript: Add-to-Cart Script

The Add-to-Cart feature enables users to add the model in their recommended size directly to cart from within the Size Advisor itself.

To set this feature up you will need to add an additional callback code to the ShoeSize.Me scripts already implemented on to your product pages. This will create a function called ssm_addedToCart.


How does this feature work? After a shopper receives a recommendation in the Size Advisor they will be displayed their size and a button with a call to action: Add to Cart. When a shopper clicks on add-to-cart, the plugin will trigger the the ssm_addedToCart function with the recommendation value/size. 


Please follow these steps to set up your Add-to-Cart Feature:

  1. First, you will need to refer to and go to the Product Script already integrated on your product pages. You can find this script by clicking here.
  2. You will then need to modify the  String a.text as shown below, adding the function inCart.
          a.text ='{shopID:"'+shopId+'",shoeID:"'+shoeId+'",locale:"'+locale+'",scale:"'+scale+'",'+
    'inCart: function(recommendation){if(typeof ssm_addedToCart == "function"){ ssm_addedToCart(recommendation)}}}';

The following callback waits for a click on the Add to Cart button within the Size Advisor on the recommendation page.

inCart: function(recommendation){
if(typeof ssm_addedToCart == "function"){

It tries to call a function named  ssm_addedToCart(recommendation) sending the recommendation parameters.


IMPORTANT: This function isn't defined by ShoeSize.Me. You or your techincal team will need to  implement it to trigger your webshops native Add-to-Cart function.


Need help? Contact us at support@shoesize.me