Hi @emyabdel
Are you using any cache plugin? Can you please confirm any cache is enabled from your hosting side?
I have tested three times and it worked properly. It looks like there is a caching issue.
I use wp rocket cache plugin on WordPress. from hosting side there’s no cache. It works now because I clear wp rocket cache every 10 hours and if I don’t clear the cache the button will not work until I clear it. I hope there’s a solution because I don’t want to clear the cache every 10 hours for the rest of my life LOL
Thanks for your answer, I use a widget where I enabled the Show Purchase Button in downloads sidebar.
In the link, they say: “If you have a cart widget that shows the number of items in your cart, and it does not function correctly with caching, it is probably using PHP to update the item total, and therefore must be excluded based on a cookie”.
As they say, I go to: WP Rocket → Advanced Rules and entered in the Never Cache Cookies field: edd_items_in_cart
and saved.
While wp rocket preload, I got an error, “Error establishing a database connection”, I reboot the VPS and the site works again and I wait until the preload is complete.
That’s what I understand from the link, If that’s what I should do please tell me that’s correct, and if not please tell me what I should do exactly.
Now, I’m waiting to see if the problem will be resolved after doing this…
UPDATE: After doing this, the problem still exists.
Try also adding a cache exception for URLs that include “edd_action”
Does that make an improvement?
That’s what I did in wp rocket, please see the image in the link:
View post on imgur.com
I didn’t understand what do you mean by URLs that include “edd_action”, what are they and where can I find them?
Thanks
-
This reply was modified 4 years, 10 months ago by
emyabdel.
Have you excluded the checkout page from cache yet? If not, follow this guide to set the checkout page to never be cached: https://docs.wp-rocket.me/article/54-exclude-pages-from-the-cache
yes, the checkout page is cached with wp rocket and from easy digital downloads settings too.
+ The problem isn’t at the checkout page but on the product page, when you click on add to cart button anything happens and it will not work until I clear wp rocket cache, then it works for maybe 10 hours and it stops working until I clear the cache…
The problem exists always and it’s happening more often than before. I hope there’s a solution
-
This reply was modified 4 years, 10 months ago by
emyabdel. Reason: add more infos
Hi @emyabdel
As per your response
It will not work until I clear wp rocket cache, then it works for maybe 10 hours and it stops working until I clear the cache…
In WP Rocket plugin there is a setting of “Cache Life Span”. I think you set it to 10 hours.
In the same screen you can see “Preload” or something similar term. May be that help?
Here is the doc of WP Rocket which says it is compatible with EDD
https://docs.wp-rocket.me/article/27-using-wp-rocket-on-your-ecommerce-site
Yes, I’ve already setup Cache Lifespan to 10 hours, so the cache is auto cleared every 10 hours that’s the only thing that works but I don’t want that the cache is cleared every 10 hours, I’m searching that the button work as normal and to find a solution to fix this problem without clearing the cache every x time.
Preload is enabled since the first time I used WP rocket.
I know that EDD and Wp rocket are compatible, I want to know just why this button stops working until wp rocket cache is cleared which is not normal, surely there’s a conflict somewhere between this add to cart button and wp rocket and I”m looking to find it so this button work normal like any other button on the website. thanks so much for your help.
Hi @emyabdel
I have checked your web page https://teesvg.com/downloads/fabulous-since-1960-svg-lips-glam-birthday-png/ and added product three times in cart and it worked for me.
Right now cache plugin is activated on site?
It looks like once the cache page is generated then cache plugin serve as a static page. EDD buy button use security nonce to validate and I think because of the static page the security nonce is not going to validate.
I am trying to reproduce the same on your site but I have not seen yet.
I recommend you to ask WP Rocket plugin support also about this. They knows better how to setup the plugin with EDD. They will help you.
Thanks for your answer.
Yes, the cache plugin is always activated.
It’s hard that the add to cart button doesn’t work now because as I said the cache is cleared every 10 hours so even if the button stop working after 8 hours, the cache will be cleared after 10 hours and it will work again.
If you want to see the problem live, I must set the lifespan to 30, and then the button will stop working between 8 and 12 hours then you can see it.
My last question is do you think that it’s just a setting problem in wp rocket or EDD, I should just find and change a setting and the problem will be resolved or it’s a hard technical problem and that needs an expert to resolve it?
Does the add to cart button work properly when WP Rocket is deactivated? If so, the problem is coming from the configuration of WP Rocket.