If you are not using the latest version of our plugins, you will have to provide custom JavaScript code to make the button work.
When the add cart button option is enabled, we create an event that triggers every time a person has clicked the button. This event is called 'doofinder.cart.add'.
You need to catch this event and create a function in your code, to call your store's API for the implementation to work. This function will vary from platform to platform. You have to paste the script into your HTML code.
Example of generic implementation:
document.addEventListener('doofinder.cart.add', function(event) {
const { item_id, amount } = event.detail;
// add custom code to send the data to your cart API
console.log("added ${amount} of item #${item_id}");
});
Important Update
We have updated the add to cart feature for most platforms. For installations prior to the release of this update, of the plugins mentioned below, you do not need to copy it manually. Simply follow this previous step, to update the script in the store, which is required for it to work properly.
-
Shopify, BigCommerce: you must deactivate and reactivate the search engine from the plugin.
-
Magento2, Prestashop, WooCommerce: you must install the latest version of doofinder from the plugin's marketplace.
-
Ekm: no api for add-to-cart.
How to activate it
To enable the add to cart button in your layer, go to your Admin > Layers > Appearance.
To customize your ‘Add to cart’ button, read the article ‘Appearance’.
Add to cart with a variant
The add-to-cart feature comes with a variant that allows you to select size, for example, before adding it to the cart, without having to go through the product page.
To activate this option, please email support@doofinder.com, and we will manage it for you.