Add to Cart

Klevu Theme is platform agnostic, but certain elements must be driven by your selected ecommerce framework. Add to cart functionality is one of htem.

You must therefore implement this logic so any add to cart buttons in your Klevu Theme will work as expected. You can find some examples below.

Note: Only complete the following steps if you do not already have a function klevu_addtocart() included in your store. Please check with your frontend developer if you are not sure.

Shopify

The logic for adding an item to the cart in Shopify is quite simple. Add this to any pages of your Shopify store where a Klevu Add to Cart button might appear, ideally in your theme.liquid:

BigCommerce

The logic for adding an item to the cart in BigCommerce is quite simple. Add this to any pages of your BigCommerce store where a Klevu Add to Cart button might appear, ideally in your base.html:

Magento

The URL to add a product to the cart must be generated by Magento, as it contains protection against cross site scripting (XSS), so you will need to implement one JavaScript function within your Magento theme.

You can find our implementation of this logic here:
https://github.com/klevu/addtocart/blob/master/view/frontend/templates/klevu/addtocart/index.phtml

Other Platforms

For any other platforms, simply implement the function klevu_addtocart with your own logic of what you would like to happen when a customer clicks on add to cart: