We have Point of sales system connected to Woocommerce api.
When every Point of sales system pushes inventeroy changes my inventory is not getting updated. I ask the point of sale team they said its something to do with cache plugin. I am using WP rocket they said from there end every thing is fine.
Point of system developer told me to do this.
(See if you can add an exclusion for woo commerce api. Don’t cache anything in url that has wp-json)
If any one can help me with this issue that will be great.
Cloudflare won’t cache your /wp-json.php by default. You’d need to have a page rule with a Cache Level of “cache everything” for that to happen.
Assuming you have a cache everything page rule for your whole domain, if you want to exclude the /wp-json.php you could create another page rule, and place it above the cache everything rule so that it triggers first (just one page rule triggers for any given URL in a visit)
Rocket Loader OFF
Security Level: High
The above rule would not only prevent /wp-json.php from being cached, but also /wp-login.php and anything under /wp-admin/.
p.s.: I don’t think this topic belongs to Developers > API, as it has nothing to do with the Cloudflare API.
It would also prevent caching of everything in wp-content.
Static files under /wp-content/ would still be cached, if the settings are the ones I mentioned.
The trick here is NOT adding “Cache Level: Bypass”, as non-static cache will be bypassed anyway by the mere position of this rule before the “cache everything” one.
Thank you floripare for quick replay.
Please check the screenshoot. If i did it right
are you talking about this, this was already there before
now its mark as 2nd rule
sorry forgot to at screenshot of the previous instructions
Yes, that should do it.
The security level I had suggested was High. You chose Essentially Off, which is not recommended for the admin area.
Also, you don’t need to specify https:// when defining the URL. Without it, the rule will apply to requests for both http and for https.
After enabling both rules, you should perform a Purge Everything on the Cache tab, so the new rules will become effective.
Thank you, for your help i will find out tomorrow if that work or not
I am using the woocommerce social login (facebook and google) Both have stop working since wp rocket and Cloudflare. Any idea how to fix that
Please check the screenshot
My suggestions above where based on your initial information that you were told to avoid caching wp-json.php. However, I don’t know much about woocommerce, and wouldn’t be able to help you with this new issue.
Also, if the caching issue isn’t solved, you may need to remove the cache everything page rule altogether, and perhaps adopt a solution that uses both a WP plugin and a Cloudflare Workers to cache everything when the user is not logged in, but not cache when the user is logged in.