News:

Looking for documentation? Take a look on our wiki

Main Menu

Adding free products to cart

Started by SH, March 12, 2012, 11:42:26 AM

Previous topic - Next topic

SH

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

Alan_Smith

#1
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.

patrik60

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?

houldsworth1

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!

gringo211985

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 :)

K&K media production

With the latest vm version you can store your products with price = 0 and also add it to cart!

Dom64

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.