Open grappler opened 8 years ago
@grappler
A coupe years ago I wrote this https://github.com/shazahm1/EDD-Downloads-Cart-AJAXed (oringally based on a plugin for eShop (I don't think any of the original code actually exists).
It adds a new widget which fetches the EDD cart via an ajax query rather than loading in page. I used it for well over a year successfully. That said I have not used it for about a year so I'm not certain if it still works... though it is actually pretty basic, so it should work fine.
Thanks @shazahm1 I was able to create a solution for myself but there is a bit of a delay.
It would be nice if there was a standard local data that we developers could use.
@grappler
I'm guessing your solution uses an ajax request too, hence the delay, right? You could set up this plugin https://github.com/dannyvankooten/plugin-endpoints that way only EDD is loaded when making the cart request. The response time can be significantly reduced. Honestly, I never took this route because it would have been too much work because EDD does not use endpoints for cart actions.
As an aside, I use WP Menu cart now an WP Rocket for the page caching which has builtin in support for EDD. Seems to work pretty well. Something I can tell you which does not work...W3TC, the Pro version, is supposed to support fragment caching where you can mark dynamic segments within the code so it would not be cached — I never was successfully able to get that to work.
@shazahm1 Yes, I am using ajax. Thanks, that looks like a really good plugin, not just for this use here but for other places too but I found a better way by creating a mu plugin. I got part of the idea from Migrate DB Pro. https://gist.github.com/grappler/289944193cf0ed916dc8
@grappler yep, that is exactly what the endpoints plugin does too. It never occurred to me to base it on page URL like you've done. I'm gonna have to lift that and tweak it for my site :) Thanks for sharing!
Great discussion guys. I'm going to milestone this for 2.7 so we look at it closer.
This could be an interesting feature. Worth a look for sure.
Hey,
I would like to keep my single download pages cached but change the "Add to cart" button to "Checkout" using JS.
I thought of three ways I could check if the download has been added to the cart.
Having a method to check via JS if a download has been added to the cart could help with other scenarios. e.g
What do you think of the idea?