How to add multiple products to cart with one click in Virtuemart?

These workarounds are fully comaptible with Virtuemart and you don't need extra extension to use it. It is a built in feature in Virtuemart.

With the following code there will be 2 products added to the Virtumart cart automatically.
Product IDs: 316, 314 - This code should be copied and pasted into your content where you want to display your offer.

https://example.com/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=316&quantity[]=1&virtuemart_product_id[]=314&quantity[]=1

Changing the quantity

You can define how many products you want to add by modifying the "&quantity[]=1" part:

&quantity[]=15

If you are using AWO Coupon you can add the coupon with the same click by adding the following line:
In this case the summer20off is the coupon code you share with your customers, you don't need coupon IDs.

&addcoupontocart=summer20off

Using it as a link for a special offer/bundle
You can put the link anywhere, like into Joomla content, newsletters, Fb posts etc.

<a href="https://example.com/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=316&quantity[]=1&virtuemart_product_id[]=314&quantity[]=1">Check out our special deal</a>

To use as a button just simply add the following class to your link:

class="button"

By html form

In case you want to use a form you can copy and paste the following code:

<form method="post"/>
<input class="button" title="Add to Cart" type="submit" name="addtocart" value="Add to Cart"/>
<input type="hidden" name="option" value="com_virtuemart"/>
<input type="hidden" name="view" value="cart"/>
<input type="hidden" name="task" value="add"/>
<input type="hidden" name="virtuemart_product_id[]" value="316"/>
<input type="hidden" name="quantity[]" value="1"/>
<input type="hidden" name="virtuemart_product_id[]" value="314"/>
<input type="hidden" name="quantity[]" value="2"/>
</form>

There are some tricks how you can improve user experience for using this kind of addtocart feature in Virtuemart.


Blog


Cloudhoreca Kft. and this site is not affiliated with or endorsed by The Joomla! Project™. Any products and services provided through this site are not supported or warrantied by The Joomla! Project or Open Source Matters, Inc. Use of the Joomla!® name, symbol, logo and related trademarks is permitted under a limited license granted by Open Source Matters, Inc.