[ET-2015] Adjusted the logic for calculating fees when using Stripe. #2964
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎫 Ticket
ET-2015
🗒️ Description
In a previous PR (#2403) we removed certain parts of the
is_licensed_plugin
logic due to its resource-intensive nature, especially noticeable on the checkout page when Stripe is enabled. This PR reintroduces the logic with the idea of caching the revalidation ofid_current_license_valid
.Scenario -
When $revalidate is true we need to check the most recent license. This happens here. This method is always called when you checkout for Stripe to see if the fee must be added.
I added in additional caching when
$revalidate
is true. The cache will only last an hour and will help alleviate multiple calls tois_current_license_valid
which is resource intensive.I originally tackled this using Tribe Cache. However, I found that the value wasn't being kept in the cache and it was blank every page load. Therefore I moved forward using transients instead.
🎥 Artifacts
✔️ Checklist
readme.txt
file.wpunit
orintegration
tests.wpunit
orintegration
tests.