virtuemart add to cart button not working

Virtuemart is a great piece of eCommerce software to use in conjunction with joomla.

If you've been building a store and find like me that you have problems with the add to cart button not working, then here is a collection of ideas that i have used, to get it working for me.

The first thing to do is check that it is working when you type your domain name with www.

My problem was that when i had the www infront of my domain, the add to cart button worked perfect, but when i had no www infront, then the add to cart button wouldn't work.

The options to fix this are:

going into your virtuemart configuration settings settings, and selecting site. There should be settings relating to your site address, and you can try putting the www in front of the address if its not already there.

If you find that doesn't work, then try editing your .htaccess file (this applies only if you have mod rewrite on)

Add the line

rewriteCond %{HTTP_HOST} ^domain\.com$
rewriteRule ^.*$ http://www.domain.com%{REQUEST_URI} [R=permanent,L]

below where it says

RewriteEngine On

This method finally worked for me, and forces any visitors who arrive at your site without the www, to be forced to be redirected to the working www site.

This has no effect on the visitors and they won't even notice.

How to install Virtuemart into joomla

add to cart button

add to cart button
add to cart button

More by this Author


Comments 7 comments

Jamie Graham 6 years ago

Thank you for this! I was having the same problem with Virtuemart and thought it was quite serious, but a two minute search brought me to this. I tried adding an item to the cart without the www and that was the problem. I did the htaccess rewrite and now everything is good.


Tholo 5 years ago

so the add to cart wont work on a localhost demo??

thats the problem i have , im trying to show it to a client and the add to cart button will not work, the site is not live?


LaaB 5 years ago

I know it has been posted a long time ago but I have to say thanks for the post, it helped me with the same issue I had with virtue mart, I am surprised they do not mention this when the component is downloaded and installed within the instructions.

Thanks again.


5 years ago

Thanks Man this helped me allot


Denis 5 years ago

Thanks a lot ... you save a lot of my clients :-)


Dirk 4 years ago

When set in VM to www.**** then the problem becomes differend, the backend of the joomla site will show errors because that part is using without www,

at least thats the error i'm getting.

I have tryed hundreds of things, htaccces/rederict plugin/site configuration with and without www, but no joy, i have been struggeling for months now.

I made a simpel solution by making the costumors click on a link where it says (if cart is not working click here) than you can add a link with or whitout www depending which one is working for you, i was out of idea's. Take a look at www.alphagames.be you can see how i did it (Dutch site)

If onyone an help me with this pls contact info@alphagames.be

Cheers


Rob 4 years ago

My problem was reverse. Virtuemart logon didnt work the the www URL, but worked fine without it. I revised the htaccess edit to...

rewriteCond %{HTTP_HOST} ^www.domain\.com$

rewriteRule ^.*$ http://domain.com%{REQUEST_URI} [R=permanent,L]

Works!

    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.


    Click to Rate This Article
    working