Support Forum [ All Topics | New Topic ]

Thread: Instant inventory "add to cart" wix


I'm trying to figure out how to integrate the "add to cart" button into my cart on Wix?
Has anyone succeeded?

thank you

>> add a comment
09/22/2020 09:34

3 Replies:

The 'add to cart ' information is found at

It is AngularJS code 

AngularJS widget - Integrate into my ecommerce

By setting up an observer in javascript you will be able to POST the diamond information to an API on your end. The API on your side must do two things in this order:
First - you must create the product in your inventory.
Second - you have to add the product to the users cart.
Finally you may return a success or an error message to the javascript application.

Example Below. Note - JS should be placed after the diamond search is loaded and included in script tags

                             							 (function(d, w) {     function observeAddToCart() {         jQuery(w).on('ds.addtocart', function(event, data) {             jQuery.ajax({                 //This is the API to where to POST the data to.                 url: '/api/add_to_inventory_and_add_to_cart',                 type: 'POST',                 data: data             }).done(function(res) {                 //On success of the API call                 w.location = '/success';             }).fail(function(res) {                 //On fail of the API call                 alert(res.message);             });         });     }     if (d.addEventListener) {         d.addEventListener('ds.ready', function() {             observeAddToCart();         }, false);     } else if (d.attachEvent) {         d.documentElement.attachEvent('onpropertychange', function(event) {             if (event.propertyName === 'ds.ready')                 observeAddToCart();         });     } }(document, window));                                                      

>> add a comment
Rapnet Technical
9/23/2020 3:57:00 AM
thank you for your reply,
However I have an authentication failure message yet my API key is good. Where can the problem come from?

>> add a comment
9/23/2020 5:14:00 AM

It's ok, I had to use lines instead of dots to point to my website in the instant inventory settings

>> add a comment
9/23/2020 12:39:00 PM