Open navigation

Customizing Add to Cart for Other Platforms

This content contains older information from our previous Javascript library. Please visit the link if you have implemented Klevu with the latest template JS.

Add to Cart button for other platforms can be customized by following the below steps :

  1. Add the following script at the bottom of all the pages:
    <script>
       function klevu_addtocart( id, url, qty ) {
          // your add to cart implementation goes here...
        }
        // changing the label for add to cart button
        var klevu_addtocartLbl = "Add To Cart";
    </script>
  2. Add your code for adding products to cart inside klevu_addtocart  function.
  3. Change value of the klevu_addtocartLblvariable.
    • For displaying button with text (Default)
      var klevu_addtocartLbl = 'Add to cart';
    • For displaying image as button
      var klevu_addtocartLbl = '<img src="img/cart.png"/>';

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.