Author Topic: Add to cart not working on some devices  (Read 1678 times)

chaldama

  • Jr. Member
  • **
  • Posts: 78
    • Joomla Website Designer
Add to cart not working on some devices
« on: October 31, 2017, 09:47:14 am »
Hello all,

Currently one of the websites I monitor is having a weird problem. On some computers/tablets/phones the add to cart button is not functioning. The spinning wheel just keeps loading but products never actually make it to the cart. For me it's difficult to test this, since on all my own devices there is no problem. There are no errors in log files, all extensions are up-to-date.

This is the URL: https://vergaderkoffers.nl
PHP Version 5.6.31, Joomla 3.8.1, VirtueMart 3.2.4. Yootheme template Monday, VMUikit 4.5.4

In other posts I could not find anything helpful.

Jumbo!

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 679
  • Full-stack Web Developer
    • www.virtueplanet.com
  • VirtueMart Version: Always latest
Re: Add to cart not working on some devices
« Reply #1 on: October 31, 2017, 10:21:02 am »
The issue has nothing to do with the devices. It is a cross origin Ajax call issue of your site.

Add to cart will not work if you access your site with this url - https://www.vergaderkoffers.nl But if you try with this url - https://vergaderkoffers.nl then it will work fine.

It is a basic "www" and "non-www" prefix resolving issue.

Your domain name should never resolve both with "non-www" and "www". That means the site should be made accessible either using www.your-site.com or your-site.com.

You need to make sure that www requests are redirected to no www. Which will also improve your search engine/crawler performance. Refer to this StackOverflow post for more details: https://stackoverflow.com/questions/234723/generic-htaccess-redirect-www-to-non-www This will resolve your problem. Basically you just need to add the following redirect rules in your .htaccess file.

Code: [Select]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

chaldama

  • Jr. Member
  • **
  • Posts: 78
    • Joomla Website Designer
Re: Add to cart not working on some devices
« Reply #2 on: October 31, 2017, 18:13:00 pm »
Thank you Jumbo, this was however not the problem. I do agree to the fact that it would be better if the Joomla .htaccess would be adjusted in the core file to enable the rewrite from non-www to ww or vice versa.

Problem is solved by disabling the offcanvas cart en using the normal VM cart instead.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4185
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Add to cart not working on some devices
« Reply #3 on: October 31, 2017, 18:58:49 pm »
Solved or not, you should add the RewriteRules for google SERP

aftertaf

  • Jr. Member
  • **
  • Posts: 205
    • sO couture
  • VirtueMart Version: 3.2.14
Re: Add to cart not working on some devices
« Reply #4 on: November 07, 2017, 23:54:23 pm »
what do you mean by the offcanvas cart ?
I have had reports of similar issues on my website when people are using iPhones but I don't have one to test with...
Gonna try the .htaccess change too FWIW...
I'm not currently using HTTPS, can I apply the above change all the same ?
David
Webmaster for my wife (link in my profile ;)
Extensions / plugins : POSForWebshops, TemplatecreatorCK ,MaximenuCK, and PageBuilderCK, VM BatchEdit Pro, VM CustomFilters Pro, Awocoupon Pro, slogin, supersaas,  among other things...
Joomla! 3.8.6//VM 3.2.14//PHP7.0.18 & mariadb 10.1.22 on Debian
big up to notepad++!!!!

chaldama

  • Jr. Member
  • **
  • Posts: 78
    • Joomla Website Designer
Re: Add to cart not working on some devices
« Reply #5 on: November 08, 2017, 08:38:05 am »
I also changed the .htaccess just to be sure, for a non-SSL site just change https to http and it should work.
I used to use the offcanvas cart extension from VMUikit

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4185
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Add to cart not working on some devices
« Reply #6 on: November 08, 2017, 18:25:00 pm »
Check with vmuikit support or disable it and check with Joomla protostar template.