Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd Party Plugin Compatibility: WooCommerce + Reduce Order Stock #597

Closed
raamdev opened this issue Oct 28, 2015 · 21 comments
Closed

3rd Party Plugin Compatibility: WooCommerce + Reduce Order Stock #597

raamdev opened this issue Oct 28, 2015 · 21 comments

Comments

@raamdev
Copy link
Contributor

@raamdev raamdev commented Oct 28, 2015

WooCommerce has some compatibility for WordPress caching plugins via the DONOTCACHEPAGE constant, however there is room for improvement. For example, one user reported that "when the website has a shop order and the stock is reduced, the cache for that product isn’t cleared resulting in stale stock levels being used / displayed".

There may be WooCommerce hooks that we can attach to (such as woocommerce_reduce_order_stock) that will improve compatibility with WooCommerce.

This GitHub issue exists as a place to track improvements to compatibility between ZenCache and WooCommerce.

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Nov 18, 2015

I'm having issues with this on my website at the moment. Stock levels are often out of date and I don't know what to do about it. Clearing the cache frequently isn't an option either because then the site is too slow. Is there any workaround to get it to re-cache product pages when stock levels are updated?

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Nov 18, 2015

@mastermikeywwt We don't have an immediate answer, unfortunately. Is there a way? Yes, I'm fairly certain there is, but it will require some research and digging into the WooCommerce codebase. That will happen whenever this gets added to a development cycle. We prioritize bugs over everything else, and then it mostly goes by interest. The more votes this issue gets, the more quickly we can spend time digging into it. :-)

If you dig in and have anything to share, please let us know--that might make closing this a bit easier.

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Nov 30, 2015

Hey sorry is there any update on this? We're still having the same issue unfortunately. Products stock levels change very frequently so its almost impossible to keep up with.

I'd love to help but unfortunately I don't think I have the skills to.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 2, 2015

@mastermikeywwt Improved WooCommerce compatibility to auto-clear the Product cache file when stock changes is coming in the next release; see wpsharks/comet-cache-pro#191

If you're interested in testing a beta release of ZenCache before the next version comes out, please sign-up to be a beta tester here or see ZenCache → Plugin Updater → Beta Testers to automatically receive Release Candidate updates (available since ZenCache Pro v151114).

raamdev added a commit to wpsharks/comet-cache-pro that referenced this issue Dec 2, 2015
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 2, 2015

Next Pro Release Changelog:

  • WooCommerce Compatibility: This release improves compatibility with the WooCommerce Product Stock feature. When the Product Stock changes, ZenCache will now clear the cache file for the associated Product to ensure that the stock quantity that appears on the site remains up-to-date. See Issue #597.

@raamdev raamdev closed this Dec 2, 2015
@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 3, 2015

This doesn't seem to be working for me still for some reason. are there any special options I need to enable in the new version to enable this feature?

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 3, 2015

@mastermikeywwt The new version has not been released yet. We're targeting that for end of next week.

If you're interested in testing a beta release of ZenCache before the next version comes out, please see my comment above: #597 (comment)

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 3, 2015

Its the beta I'm testing at the moment

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 3, 2015

@mastermikeywwt There is no beta released that includes the work from this issue. We're anticipating the next RC release by end of the day tomorrow.

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 3, 2015

Ah right I see. Apologies for the misunderstanding. Will the new release include the required update to PHP 5.4? I still need to do this on our server you see.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 3, 2015

Yes, the next release will require PHP 5.4 or higher.

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 14, 2015

Hey sorry to keep messaging about this but I'm still waiting on that RC release. Any ideas when that might be out? :)

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 15, 2015

@mastermikeywwt Within the next 24 hours. :-) We had a bug that held up the RC but we're past that now; it will be out soon. Thanks for your patience!

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 16, 2015

Thankyou. Just getting difficult manually clearing the cache of pages when we sell stock. We're so busy this year its unreal :O.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 16, 2015

@mastermikeywwt The ZenCache Pro RC, which includes the improved WooCommerce compatibility, has been released. 😄 See http://zencache.com/zencache-pro-v151216-rc-release-candidate/

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 17, 2015

I've installed the new version and it appears to work pretty well. I do have a request though (A rather important one for us). While the cache does clear on the page when an order is placed on the website, it doesn't clear the cache when there is a stock update in the backend. For instance we link our site stock levels to our shop floor. When we sell something there is pushes the new stock levels to WooCommerce. When this happens the cache is not cleared. Is there any way you could trigger the cache of the pages to clear when there is a feed update?

In the mean time is there a way of clearing the cache regularly and having it recache those same pages immediately after? I've tried using the sitemap feature but we actually have more than 1 sitemap.

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 17, 2015

@mastermikeywwt writes...

when there is a stock update in the backend. For instance we link our site stock levels to our shop floor.

How are you linking the site stock levels to your shop floor?

ZenCache hooks into WooCommerce via the woocommerce_product_set_stock hook, which is fired whenever the WooCommerce set_stock() function is run. If you're updating the stock levels using some custom code that doesn't use the WooCommerce API, you'll need to make sure you also fire the proper hook so that ZenCache clears the cache for the associated product:

do_action( 'woocommerce_product_set_stock', $this );

$this should be an instance of the WooCommerce WC_Product object. See also the WooCommerce set_stock() function to better understand how this works inside WooCommerce.


To use the ZenCache API to clear the cache dynamically, see:

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 17, 2015

It updates the column in the database using MySQL as I understand. Is there anyway to clear the cache around this?

I'll look into that link as that may be a good workaround for now :)

@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 17, 2015

It updates the column in the database using MySQL as I understand. Is there anyway to clear the cache around this?

You'll need to add some code to whatever script updates the database so that it also fires the woocommerce_product_set_stock hook for WordPress. If you're working with a developer, I suggest deferring to him or her. :-)

@mastermikeywwt
Copy link

@mastermikeywwt mastermikeywwt commented Dec 17, 2015

Perfect thankyou. I'm the case with them now. Its a company called Veeqo. Its basically manages sales across several channels like ebay, Amazon, WooCommerce. Hopefully they sort it for me. Sounds like this is the proper way to push stock levels

@wpsharks wpsharks locked and limited conversation to collaborators Dec 21, 2015
@raamdev
Copy link
Contributor Author

@raamdev raamdev commented Dec 21, 2015

ZenCache Pro v151220 has been released and includes changes worked on as part of this GitHub Issue. See the release announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#597).

@wpsharks wpsharks unlocked this conversation Dec 30, 2015
@wpsharks wpsharks locked and limited conversation to collaborators Dec 30, 2015
@raamdev raamdev changed the title 3rd Party Plugin Compatibility: WooCommerce 3rd Party Plugin Compatibility: WooCommerce + Reduce Order Stock Dec 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants