Purchase multiple items with single Dynamic checkout button

New Member
7 0 0

Is there any way to purchase multiple items simultaneously with a single dynamic checkout (buy it now) button?

 

I currently have the following:

{% assign variant = product.selected_or_first_available_variant %}
{% form 'product', product %}
    <input id="hidden-variant-id" name="id" type="hidden" value="{{ variant.id }}" />
    {{ form | payment_button }}
{% endform %}

and I'm using Javascript to change the value of the id input as the user switches variants.

 

However, my client wants to be able to purchase multiple products as a bundle on a single page. I have all of the variant ids for the various items to purchase, but it's not obvious whether there's any way to accomplish this within the product form.

 

Is it somehow possible to use a form with a 

action="/cart/update"

instead of 

action="/cart/add"

 to add multiple variants at once?

 

Alternatively, maybe it's possible to create a checkout object with Javascript and send that to the Dynamic Checkout button somehow?

0 Likes

Here is how you can add multiple products to cart that belong to a collection https://gist.github.com/carolineschnapp/9122054

 

And the same thing using Ajax http://www.codeshopify.com/blog_posts/how-to-add-multiple-products-with-an-ajax-cart

 

By combining both ideas I have created something like https://nichegeek.myshopify.com/collections/bundles/products/football-bundle 

Available for hiring. Inbox me lixonic[at]gmail[dot]com
0 Likes
New Member
7 0 0

Thanks @Lixon_Louis 

 

Have you had any luck combining this approach with dynamic checkout buttons?

https://help.shopify.com/en/manual/sell-online/online-store/dynamic-checkout

 

I haven't yet, although I'm not 100% sure that I'm combining the correct form action with the correct inputs.

0 Likes

Not sure about the checkout method, but you can skip the cart if you want to.  I have updated the example here 

https://nichegeek.myshopify.com/collections/bundles/products/football-bundle

 

 

Available for hiring. Inbox me lixonic[at]gmail[dot]com
0 Likes