VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: SH on March 12, 2012, 11:42:26 AM

Title: Adding free products to cart
Post by: SH on March 12, 2012, 11:42:26 AM
Is there a way to enable free products to be added to the cart?
I'm working on a site where my client is giving away free products but the customer only pays for postage and packing.
When a product has a zero value it is not possible to add it to the cart as the 'add to cart' option is not there.
Any way around this?

Thanks
Title: Re: Adding free products to cart
Post by: Alan_Smith on March 13, 2012, 14:27:00 PM
Add to cart has a parameter for zero pricing so you need to create condition function for zero price so that this value can be added into shopping cart. Use if condition as 'if (ProductVariant! ='0')' and then write all normal coding to add to cart function. This is an easy way to enable free products to be added to the cart.
Title: Re: Adding free products to cart
Post by: patrik60 on March 28, 2012, 17:51:28 PM
QuoteAdd to cart has parameter for zero pricing so you need to create condition function for zero price so that this value can be added into shopping cart. Use if condition as 'if(ProductVariant!='0')' and then write all normal coding for add to cart function. This is easy way to enable free products to be added to the cart.

Sorry, I absolutely don't understand what this means??? Where, in which file do I have to write this if condition?
Title: Re: Adding free products to cart
Post by: houldsworth1 on May 20, 2012, 23:24:48 PM
Not sure if you received your answer but I was just trying to do the same thing and managed to complete this by using the override.

On the product page give the product a price of $0.01.  Then check the override check box and set the price in there to zero (it is probably zero already). 
This will then allow you to add the product to the cart but it will show a discount of the amount you entered ($0.01 in my case). 

Not ideal...but it seems to work.

Hope that helps!
Title: Re: Adding free products to cart
Post by: gringo211985 on July 29, 2013, 14:49:37 PM
This is for people still looking for this answer!

Instead of hacking code or editing CSS etc. there is a really simple way,

Set your product "cost price" to 0.00001 and voila you can add the product to your cart for 0, but people will still have to pay postage depending upon your shipping rules.

Hope this helps :)
Title: Re: Adding free products to cart
Post by: K&K media production on July 29, 2013, 17:08:55 PM
With the latest vm version you can store your products with price = 0 and also add it to cart!
Title: Re: Adding free products to cart
Post by: Dom64 on April 06, 2016, 22:37:53 PM
Quote from: kkmediaproduction on July 29, 2013, 17:08:55 PM
With the latest vm version you can store your products with price = 0 and also add it to cart!
How?
How do you do it?
My shop is Joomla 3 / Virtuemart 3 and I try to create a product with price of 0 (not "no price", but a price which happens to be 0.0) and I manage to get a "cost price" of 0.000 but the final price stays blank (not 0)...
Is there a configuration switch, or something?

Thanks in advance for your help.