Quantcast
Channel: Opinion: Shopify Community - Shopify Apps
Viewing all articles
Browse latest Browse all 11091

Chris Reed commented on Add Multiple Items to Cart in One Click or Product Bundle

$
0
0

Hi Alex,

I'm a developer and might be able to help. I've cooked up some code that will add four of your products to the cart in one hit, so the user could achieve this by clicking a button. This is a little raw and doesn't have any nice loading messages/animations (this could be added) but if you want to see this in action, you can - using Google Chrome, right click (or control click on a Mac) somewhere on your home page and click "Inspect Element" from the bottom of the menu that appears.

This should bring up a panel containing some source code (see my attached screenshot); locate "Console" (see top right of the screenshot) and click it. 

In the new panel that appears, right click (or control click) amongst the messages and click "Clear Console", then paste this in and press enter:

ajaxMultiBuy=function(o){var a=o.shift();console.log("Adding "+a+"..."),$.ajax({type:"POST",url:"/cart/add/?id="+a,dataType:"HTML",success:function(){console.log("Done."),0==o.length?(console.log("Loading cart..."),window.location.replace("/cart")):ajaxMultiBuy(o)},error:function(o){}})},productIDs=[5495746753,6404592577,6872949825,10372164673],ajaxMultiBuy(productIDs);

A few seconds later, you should be taken to your cart to find four products added.

Is this the kind of thing you are looking for? What is your budget? I would happy to assist with implementing this for you, including a nice loading animation for better usability. Send me a private message if you're interested!

Thanks,

Chris


Viewing all articles
Browse latest Browse all 11091

Trending Articles