Hello, I am not sure if this is a Joomla thing or Virtuemart, but I need to add "add to cart" button on some pages independent from the store, under the product pictures, so when someone clicks on it, basically adds the product to cart without being re-directed to "add to cart" page. Can someone help me how to do this? I have been searching for this on the internet, but could not find something useful to address this issue. Thanks
create a button/link with these parameters
yoursite/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=22&quantity[]=2&virtuemart_product_id[]=55
example will add 5 x product id 22 & 2 x pid 55
****** edited virtu to virtue
Or you can use our addtocartlink plugin.
Thanks to it, you can Add to the cart and even on a website where VirtueMart is not installed
Hello, thank a lot for your answer. I could not find this plugin on the site, do you have a link that you can share with me?
I also tried to create a button & link with the below paths, but none is working, not sure if I am making a mistake somewhere or something is not working on my template;
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2021&virtuemart_category_id[]=1&quantity[]=1
/?index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2021&quantity[]=2&virtuemart_product_id[]=2025
index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2021
http://www.mysite.com/?index.php&optionvirtumart&view=cart&task=add&quantity[]=5&virtuemart_product_id[]=2026&quantity[]=2&virtuemart_product_id[]=2021
www.mysite.com/?index.php&optionvirtumart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2021
http://www.mysite.com/index.php?page=shop.cart&option=com_virtuemart&Itemid=1&func=cartAdd&product_id=2025&quantity[]=1
This plugin is completely new (we added to customer shop last week) and not in eshop yet (I need create translate and Box and article on there).
I think in next week I will to add shop www.minijoomla.org
But you can try on this domain: https://www.zelenazeme.cz or you can add to your website as button link with example this URL:
https://www.zelenazeme.cz/?product_id=112&option=com_virtuemart&view=cart&quantity=2&addtocartlink=1
yan77.
When you want help please give your Virtuemart version.
index.php?page=shop.cart&option=com_virtuemart&Itemid=1&func=cartAdd&product_id=2025&quantity[]=1 is for Vm 1
index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2021&quantity[]=2 is for Vm 2+
If it not work then try using the full link
https://YOURSITE/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[]=2021&quantity[]=2
Hi again, thanks again for the info. Can you please notify me when it is available to the shop with its link?
As far as the link, somehow these links do not work on my site, the only thing I need to do is to replace the url with my site and change the product ID, in my case I am trying a product with the ID number of 2021;
https://www.mysite.com/?product_id=2021&option=com_virtuemart&view=cart&quantity=2&addtocartlink=1
This link juts takes to an empty cart page, but not adding the product 2021 when it is clicked. Am I missing anything here or you think my site has some underlying issue that is preventing these links from working?
Hi Studio 42,
Thank you for the reply, and a good point, I am using Virtue Mart 3.8.8, however neither the full link nor the previous one does work on my side. I checked and tried with multiple different product IDs, the only thing is happening is that this link takes me to a product page to add to cart as supposed to be adding that particular product directly on the cart. Any other idea why these links may not be working on my site?
have just tested on a clean VM3.8.8 with https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2070 and the this lands u on the cart page with 1 x product id 2070 added
there was a spelling mistake on my example but this will definitely work on a VM3 site as long as the product exists, is published and has enough stock
To GJC, Patrick:
Thanks for your info and old basic idea (https://forum.virtuemart.net/index.php?topic=145261.msg515765#msg515765)
We are finished with plugin last week and now is installed and function on 8 shops our customer - he is very lucky :)
https://www.minijoomla.org/extensions/virtuemart-extensions/add-to-cart-link-for-virtuemart
There we need more info about shop for find right solution I think, because in standard installation call URL must be ok.
@GJC should that not be
https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2070
That works for me.
hi Jenks .. your right of course .. can't copy/paste to save my life.. :P
https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&quantity[]=1&virtuemart_product_id[]=2070
For multiple products use it like this -
https://yoursite.com/index.php?option=com_virtuemart&view=cart&task=add&virtuemart_product_id[0]=2070&quantity[0]=1&virtuemart_product_id[1]=2071&quantity[1]=1
Basically, just define the keys of the array.