The add-to-cart button

With the JS Implementation you can choose to place an add-to-cart button on the product tile. This button will not automatically add the product to the shopping cart. Instead, when this button is clicked the JS Implementation will emit an event which can be used to implement the add-to-cart behavior.

To hook into the add-to-cart event, we need to add local configuration for the JS Implementation. This can be done by copying the following snippet into your HTML.

  window["twn-starter-config"] = window["twn-starter-config"] || {};
  window["twn-starter-config"].on = {
    "twn.add-to-cart": function (event) {
      var productId =;
      // Using JavaScript code; add the selected
      // product to the shopping cart here

The only thing that is left is to write your own JavaScript code that will place the selected product in the shopping cart.


The snippet above is an example on how to add configuration locally.

For more information on adding configuration locally click here β†’