Caching and/or Cookies breaking WooCommerce site - wordpress

The App:
I am running a WordPress WooCommerce website and did some modifications.
Users arrive at a page called /configurator/ where they get asked different questions. After answering all questions I lead the users to a page /summary/ .
On this /summary/ page an individual result is presented to the user based on their answers in the /configurator/. Also I create a cookie on /configurator/ with all answers.
I use the cookie also on /cart/ and /checkout/ to add individual information to the product we sell to the user.
The Problem:
When we went live with the website we turned on "production mode" for our website at the admin panel of our hoster. It basically turns on the CDN and enables caching.
Unfortunately users experienced problems on /summary/. It seemed that the page couldn't be loaded.
My analysis:
I think the hoster caches /summary/ and breaks my site. Following this article it makes sense that the site doesn't work any more: https://docs.woocommerce.com/document/configuring-caching-plugins/
„These pages need to stay dynamic since they display information specific to the current customer.“
What the hoster says:
The hoster says they cannot exclude any subpages from being cached: "The problem was caused by coding errors in combination with the cookies that we create on /summary/"
Current Status:
I need to leave the site in development mode (without CDN and cache) which is very slow. Based on what the hoster says I can't turn on production mode because it will probably break the site again and we lose a lot of money. Currently I cant reproduce the error on a cloned version of the site :(

You should rewrite your code and instead of using cookies use WC Sessions. Every customer has a session that already works and persists throughout the whole site, just set your data in it and use it at all pages you need.

Related

When i visit first time on wordpress website, its open another website automatically on first click

When I visit first time on WordPress website, its open another website automatically on first click anywhere, I don't know why its showing this strong text
Of course, it is better to have more details. But if this happened without any actions from your side, I would agree with Michela - it could be some malware on your website.
If you don't know what's going on under the hood, it is hard to cleanup the website completely.
As a first action, I can recommend you to check if your hosting provider have any backups for the website. It is possible that you will be able to restore to the point when the website was clean.
To clean the website by yourself, you can use various Malware Scanner plugins, like Wordfence or other specific. They can check for changes inside Wordpress core or standard repositories + they can check for strange, vulnerable and malicious parts of code. But be careful - if you have some custom code, it is better to check it with the code author.
If you'll be able to cleanup the website, I will highly recommend to go harden the website security. Some classic recommendations may be found in the official documentation - https://wordpress.org/support/article/hardening-wordpress/.

Logged-in Users need to Refresh page to see content

Hi I'm having an issue with a site where visitors need to be members to access certain pages, but once logged in they go to these pages and still see the 'not logged in' page and need to refresh to view the actual content.
This obviously leads to a lot of bounces and I'd like to fix so that they see the content right away.
The root issue comes from some cache settings or something from the host - unfortunately we can't change host (and it's not a regular hosting company with a website but a design company reseller) for the time being. This issue does not occur in our offline environment of the same site.
I've already had to add a ?randomnumber to the stylesheet so it loads new versions properly. I was wondering if something like this would work - but dynamically as pages are being added all the time by different admins.
Or any other solutions also appreciated!
Thanks
Like you said, tweaking the caching settings would be the most ideal. But since that's not an option, I'd suggest adding a random, meaningless query string to the URL of the member pages so that it's seen as a 'new page' and (likely) won't cache.
So instead of /member-page
Direct them to /member-page?cache-buster=randomlyGeneratedStringHere

Weird Caching Issue - WordPress + Ultimate Member + WP Engine + Cloudflare

I am facing a very weird caching issue on my site. The site is hosted on WP Engine with Cloudflare setup. Here is the complete scenario when the user tried to access the site.
When the user upgrades to pro after successful payment, then all the pro listing should be visible to them OR I can say they can access pro listing. But after successful payment when a user tries to access the pro listing it shows you need an upgrade to pro. After hard refresh 2 to 3 times. It works normally.
Note:
I have already reached out to the support team. They are working
on it. I am just want to prepare my self for plan B :)
My site does not have any caching plugin.
I have already bypassed the caching from Cloudflare for that page.
I have added Cache Level to Bypass in page rules. Let me know if I need to add anything else to the page rules.
I am sure it is a caching issue. I am open to suggestions on how to fix that.
Thanks!
you can use wp-super cache plugin.
and you need to clear your browser cache.
I am using wp-engine. when I faced like that, I used wp-super cache plugin.
if the plugin is not working, you are working on different place.
check your file path, please. live site or staging site... because you might make a mistake..

Wordpress site is appears clear of malware, but clicking on Google search results redirects to spam sites

An issue was brought to me involving malware on a WP environment. When I search the brand in Google and click the corresponding link, I'm redirected to a 3rd party spam site.
This has been happening for a while (over a week), but my site hasn't been put on Google's blacklist. Additionally, site scanners like , Norton Safeweb, etc. all claim the site isn't compromised.
Additional details:
I found and deleted some suspicious PHP eval() functions and then did a search and replace in my pages and database for any remaining code. After the site cleared into un-blacklisted status with Google I thought it was all over, ran updates and took numerous measures to protect the site from future infection.
However the issue still persists.
Were the nameservers ever changed by the malware or attackers? Google could have the wrong DNS information for your domain and thinks its hosted at said spam site? Resubmit your site to Google or report the issue to them to resolve (may also be resolved automatically next time Google tries to crawl your domain)?
It is a strange issue I have not seen before either, have you looked at your .htaccess file in the root directory? It is also possible that this has a rewrite condition that if the referrer is Google to redirect you to the spam site.
Solved this issue. At the time when this happened, this redirect attack was fairly new.
HTTP requests from visitors who passed referrer data from Google Search or Bing were being redirected, some of the time.
By targeting only those coming in from search, the webmaster or site owner is less likely to see the issue (until informed by a third party), while still manipulating a decent amount of the traffic (50% of traffic for most sites comes from search engines).
When I originally posted this question in 2012, this attack was new and because the redirect was being served server-side (directly in a lone PHP file, not via .htaccess), malware signatures from scanners didn't detect this.
Running Maldetect (with an updated database) was the best way to quarantine this issue and analyze the extent of the damage caused by malware.
This issue seems due to wp-vcd Malware that creates rogue WordPress admin users and injected spam links. I faced the similar issue and it got resolved after following these steps.
The files you should check for and delete:
wp-feed.php
wp-vcd.php
wp-tmp.php
Multiple copies of class.theme-modules.php, and
remove a bunch of code from the start of all the functions.php files.
For details you can find on this issue at following links...
https://wordpress.org/support/topic/wp-feed-php/
http://labs.sucuri.net/?note=2017-11-13
http://labs.sucuri.net/?note=2017-11-13

How Do I Rollout WP-Cache To 1000 WordPress Blogs?

My client has 1000 WordPress blogs hosted on a server for customers. Each one is in its own domain through cpanel and SuPHP, running in CGI mode on Apache2.2. Now he wants me (I'm the PHP programmer) to get WP-Cache loaded out on each of these blogs and not just activated, but enabled. He also wants the timeout value set to 2 days instead of the default setting.
I have root on LAMP.
What is the preferred way to roll out an update to each blog such that on a page view, it sees if WP-Cache is enabled or not. If not, it needs to copy it out from a central source, activate it, and then enable it along with the different timeout value being used.
A way, maybe not the best way, is to write a script to copy the wp-cache plugin to every wp-content/pulugins folder. Then run another script that will go and modify every DB entry for it enabling it.
If not done correctly this can be devastating as it hits customer db's.
However, one thing to note is wp-cache has a history of killing other plugins. So, if you go in and add this plugin to everyone's wordpress it might hurt there experience if it hurts another plugin they have installed thus increasing support costs as people might be emailing trying to figure out what broke.
I take it this is being done to work on performance issues. Is it possible to maybe do some type of server caching outside of wordpress?
edit: after reading Joes comment I concur with him. Didn't even cross my mind.

Resources