Creating an "add all to cart" feature?

by k2d - Member - 09:44PM, Sep 11, 2008

OK…I’m almost there. I need to add a function where I can enter various quantities for each item and then hit one button at the bottom of the page that totals up the entire page. Currently, I have to hit the add to order for each item…it goes to cart and them I have to hit back to order button.

Any Ideas?

Take a look at my product page at: http://danpostsocks.myshopify.com/collections/collections

pw: socks

Thanks for your help!

Jamie

Member

12:17AM, Sep 12, 2008

Not on seperate products. Not that I know of without some custom javascript programming.

k2d

Member

12:33AM, Sep 12, 2008

Hum…The functionality is almost there. It is really like I need to have every item in the shopping cart and then let them inter the quantity they want of each item and then they can click proceed to check out.

Anyone else have any ideas?

HunkyBill

Member

12:04PM, Sep 12, 2008

@k2d.

Use javascript. When outputting your add-to-cart buttons, attach a listener for the ‘click’ event. When clicked, read the quantity in the text field. You can then call the Shopify API function for add-to-cart, sending it the quantity and Product ID.

Very clean, and works like a charm… For examples you can view A+ environmental supplies.

http://www.aplusenv.com/products/poly-sheeting-clear-n465-73

Notice how a click sends the product to the cart. If you had a quantity in a text field, the same call would work.

Now, if by the same token you wanted an ADD ALL button, your listener to that ‘click’ would go through the entire form and for each Product, repeat the process as per the single product. The API call for add-to-cart can accept an array of products I believe, so hopefully that means a corresponding quantity per Product ID. Would have to double check on that.

Not a big deal to play with variations on this theme.

k2d

Member

01:47PM, Sep 12, 2008

Thanks Bill. I sent you an email.

Jamie

Member

02:27PM, Sep 12, 2008

There you go… javascript kung foo!

Jsteb

Member

01:34PM, Oct 13, 2008

I have a very similar need. Implementing one “text” input for a single variant worked fine, but once I introduced multiple variants, the logic wasn’t there.

I think the solution discussed here would work quite well. Here’s the store – http://printerfreaks.myshopify.com.

Any ideas or help is much appreciated.

You must login to post a comment!

Don't have an account yet? Sign up for one.