WordPress.org

Ready to get started?Download WordPress

Forums

FoxyShop
[resolved] One "Add to Cart" button for multiple products (3 posts)

  1. KerriM
    Member
    Posted 1 year ago #

    I'm trying to create a very simplified shop page — just one page (the "all-products" page) with multiple products, product descriptions, and quantity fields. (Products do not link to a product detail page, you should just be able to place your order right on that page). The products do not have variations. The only option is quantity

    What I'd like to do is be able to have quantity boxes for each of the (three for now) products, and a SINGLE add to cart button, so the user can add in quantities for each product, and then "Add to Cart" only once. (As opposed to having to add one product to the cart, then "go back" and add another).

    I can only figure out how to add an Add to Cart button to each product individually. Is it possible to do what I'm trying to do here?

    Here's a screens shot of what the interactive part of it should look like:
    https://dl.dropbox.com/u/2890872/add-to-cart.png

    http://wordpress.org/extend/plugins/foxyshop/

  2. sparkweb
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Kerri, so sorry I didn't get to this earlier! My RSS feed sometimes doesn't pick up these threads until it's been a few days. For faster support, email from foxy-shop.com.

    What is needed in this case is something much more than a simple change. What you'll need to do is actually setup a product loop that appends 1: and 2: and 3: to all the products. So you'll setup the form outside the loop, then do the hidden form attributes manually.

    I've created some sample code to explain better: http://pastebin.com/eU5YYBg8 - you'll still need to do the loop and your own code, but you can see what I've done here.

    One important thing to note is that you can't use this method with lots and lots of products because it sends all the form data to FoxyCart in a GET string and browsers won't do that in an unlimited way. 3 products should be okay, but if you try to send 20 you'll likely get errors or it won't send all the data.

    Does that help?

  3. KerriM
    Member
    Posted 1 year ago #

    Thanks so much for the excellent example. I see your poin though about the GET string length, and I want these guys to be able to expand their product offering easily, so I've convinced them to use a more traditional "add to cart" method. I'm saving that code, just in case it comes in handy for in the future, though. Thanks for the time you took with a very specific use case.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags